Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Turbot Tags table data #66

Open
bob-bot opened this issue May 9, 2023 · 1 comment
Open

Turbot Tags table data #66

bob-bot opened this issue May 9, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bob-bot
Copy link
Contributor

bob-bot commented May 9, 2023

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 bob-bot added the bug Something isn't working label May 9, 2023
@ParthaI
Copy link
Contributor

ParthaI commented Jun 22, 2023

@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"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants