turbot / steampipe-plugin-gcp

Use SQL to instantly query GCP resources across regions, projects and organizations. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/gcp
Apache License 2.0
39 stars 24 forks source link

GCP Tags should not be copied from labels #540

Closed ssuvasanth closed 5 months ago

ssuvasanth commented 7 months ago

Describe the bug GCP 'tags' field should not be copied from 'labels' field

Steampipe version (steampipe -v) Steampipe v0.21.1

Plugin version (steampipe plugin list) 0.47.0

To reproduce

  1. Add tags to storage buckets in gcp
  2. Run the following query in steampipe: select tags,name,labels from gcp_0c50f083.gcp_storage_bucket

Expected behavior Added tags should appear in query result But the current behaviour is that tags get copied from labels and hence labels appear in tags result when labels are added.

Additional context gcp link

https://github.com/turbot/steampipe-plugin-gcp/blob/main/gcp/table_gcp_storage_bucket.go#L205

{ Name: "tags", Description: ColumnDescriptionTags, Type: proto.ColumnType_JSON, Transform: transform.FromField("Labels"), },

misraved commented 7 months ago

Welcome to Steampipe @ssuvasanth and thanks for raising this issue 👍 !!

This looks like a bug and possibly exists in a lot of tables.

We will analyze the document you provided and the data the APIs return and make corresponding changes to the affected tables soon 👍.

ugirirajan commented 6 months ago

@misraved The same issue is there in gcp_project table. Labels are copied to tags.

bigdatasourav commented 5 months ago

As of now, Storage APIs do not provide the assigned tag information.

The tag API is available under resource-manager. It should be a separate table https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/tags_tag_binding. But as per the test, it does not support storage buckets yet.

https://cloud.google.com/apis/design/resource_names#full_resource_name