turbot / steampipe-plugin-turbot

Use SQL to instantly query the Turbot CMDB. Open source CLI. No DB required.

Home Page:https://hub.steampipe.io/plugins/turbot/turbot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Turbot Tags table data

bob-bot opened this issue · comments

Describe the bug
In the Turbot Plugin, turbot_tag table. To confirm my understanding of it:

  • table is distinct key:value pairs -- they get assigned a unique ID id.
  • resource_id field is tied to resources that have the key:value (are associated with the id)
  • all ids / key:values are returned as results because they exist in the Turbot CMDB, which means they are tags that are associated to Turbot, AWS, Azure or GCP resources
  • CMDB only has current resources -- not prior / in the past.

If all is true, how does the turbot_tags table return null / '[]' for the resource_id column? Wouldnt every tag have at least 1 resource id associated?

Steampipe version (steampipe -v)
v0.19.5

Plugin version (steampipe plugin list)
Turbot v0.10.0

To reproduce
Example, if you run this query in Steampipe:

select
  *
from
  turbot_tag
order by
  resource_ids,
  key,
  value;

You will see examples of resource Ids column with []. However I would expect at least one resource ID. Right?

When you look up any of the Tags with [] in Turbot specifically, you see there are active resources associated. A tag like "Bucket Name: bob-demo-4-12-2023" is active, in the CMDB, and in AWS with that tag. But the result for it is '[]'.

In Turbot a search like: tags:'Bucket Name'='bob-demo-4-12-2023' returns one bucket. But in Steampipe its []

Expected behavior
All tags have at least 1 resourceId associated.

@bob-bot Thank you for addressing the issue.

  • Within the Turbot plugin, we utilize GraphQL queries to make API calls.
  • Specifically, the tags GraphQL mutation is employed in the table. (You have the flexibility to provide any one of the following values: tag key, tag value, or tag ID.)
  • In the Turbot console, the resource GraphQL mutation is used to retrieve associated resources based on tags. (To proceed, we require the tag information in the form of key-value pairs.)
  • Currently, if there is a space in the tag key, the tags mutation does not return the associated resources. However, if there is no space, the data is returned successfully.
  • We have escalated this matter to the relevant team responsible for GraphQL. Once the issue is resolved on their end, we anticipate it will be resolved here as well.

GraphQL query with tag key with space between:

query MyQuery {
  tags(filter: "key:'Turbot is great'") {
    items {
      turbot {
        id
      }
      key
      value
      resources {
        items {
          turbot {
            id
          }
        }
      }
    }
  }
}

Result:

{
  "data": {
    "tags": {
      "items": [
        {
          "turbot": {
            "id": "227315799982001"
          },
          "key": "Turbot is great",
          "value": "true",
          "resources": {
            "items": []
          }
        }
      ]
    }
  }
}

GraphQL query with tag key without space between:

query MyQuery {
  tags(filter: "key:'cost_center'") {
    items {
      turbot {
        id
      }
      key
      value
      resources {
        items {
          turbot {
            id
          }
        }
      }
    }
  }
}

Result:

{
  "data": {
    "tags": {
      "items": [
        {
          "turbot": {
            "id": "210297985378170"
          },
          "key": "cost_center",
          "value": "111111",
          "resources": {
            "items": [
              {
                "turbot": {
                  "id": "184304531118179"
                }
              },
              {
                "turbot": {
                  "id": "194719281035003"
                }
              },
              {
                "turbot": {
                  "id": "184304520202843"
                }
              },
              {
                "turbot": {
                  "id": "184304520996871"
                }
              },
              {
                "turbot": {
                  "id": "184304521839151"
                }
              }
            ]
          }
        }
      ]
    }
  }
}