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

Added table gcp_secret_manager_secret Closes #592 #593

Closed ParthaI closed 1 month ago

ParthaI commented 1 month ago

Integration test logs

Logs ``` No env file present for the current environment: staging Falling back to .env config No env file present for the current environment: staging customEnv TURBOT_TEST_EXPECTED_TIMEOUT undefined SETUP: tests/gcp_secret_manager_secret [] PRETEST: tests/gcp_secret_manager_secret TEST: tests/gcp_secret_manager_secret Running terraform data.google_project.current: Reading... data.google_client_config.current: Reading... data.google_client_config.current: Read complete after 0s [id=projects/"pdket-aaa"/regions/"us-east1"/zones/"us-east1-b"] data.null_data_source.resource: Reading... data.null_data_source.resource: Read complete after 0s [id=static] data.google_project.current: Read complete after 3s [id=projects/pdket-aaa] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # google_secret_manager_secret.named_test_resource will be created + resource "google_secret_manager_secret" "named_test_resource" { + create_time = (known after apply) + effective_annotations = (known after apply) + effective_labels = { + "label" = "turbottest31021" } + expire_time = (known after apply) + id = (known after apply) + labels = { + "label" = "turbottest31021" } + name = (known after apply) + project = "pdket-aaa" + secret_id = "turbottest31021" + terraform_labels = { + "label" = "turbottest31021" } + replication { + user_managed { + replicas { + location = "us-central1" } + replicas { + location = "us-east1" } } } } Plan: 1 to add, 0 to change, 0 to destroy. Changes to Outputs: + project_id = "pdket-aaa" + project_number = "342342523453" + resource_aka = "gcp://secretmanager.googleapis.com/projects/342342523453/secrets/turbottest31021" + resource_id = "projects/342342523453/secrets/turbottest31021" + resource_name = "turbottest31021" google_secret_manager_secret.named_test_resource: Creating... google_secret_manager_secret.named_test_resource: Creation complete after 3s [id=projects/pdket-aaa/secrets/turbottest31021] Warning: Deprecated with data.null_data_source.resource, on variables.tf line 35, in data "null_data_source" "resource": 35: data "null_data_source" "resource" { The null_data_source was historically used to construct intermediate values to re-use elsewhere in configuration, the same can now be achieved using locals or the terraform_data resource type in Terraform 1.4 and later. (and one more similar warning elsewhere) Apply complete! Resources: 1 added, 0 changed, 0 destroyed. Outputs: project_id = "pdket-aaa" project_number = "342342523453" resource_aka = "gcp://secretmanager.googleapis.com/projects/342342523453/secrets/turbottest31021" resource_id = "projects/342342523453/secrets/turbottest31021" resource_name = "turbottest31021" Running SQL query: test-get-query.sql Time: 1.5s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 1. Scans: 1) gcp_secret_manager_secret.gcp: Time: 1.3s. Fetched: 1. Hydrates: 1. Quals: name=turbottest31021. [ { "name": "turbottest31021", "project": "pdket-aaa", "title": "projects/342342523453/secrets/turbottest31021" } ] ✔ PASSED Running SQL query: test-list-query.sql Time: 1.2s. Rows returned: 1. Rows fetched: 3. Hydrate calls: 0. Scans: 1) gcp_secret_manager_secret.gcp: Time: 1.0s. Fetched: 3. Hydrates: 0. [ { "name": "turbottest31021", "title": "projects/342342523453/secrets/turbottest31021" } ] ✔ PASSED Running SQL query: test-not-found-query.sql Time: 1.5s. Rows returned: 0. [] ✔ PASSED Running SQL query: test-turbot-query.sql Time: 1.4s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0. Scans: 1) gcp_secret_manager_secret.gcp: Time: 1.1s. Fetched: 1. Hydrates: 0. Quals: name=turbottest31021. [ { "akas": [ "gcp://secretmanager.googleapis.com/projects/342342523453/secrets/turbottest31021" ], "title": "projects/342342523453/secrets/turbottest31021" } ] ✔ PASSED POSTTEST: tests/gcp_secret_manager_secret TEARDOWN: tests/gcp_secret_manager_secret SUMMARY: 1/1 passed. ```

Example query results

Results ``` > select * from gcp_secret_manager_secret +----------+---------------------------+------------------+--------+---------------------------+-----------------------------------------------------------+---------------+-----------------+--------+-----------------+----------------------------------------+-----------> | name | create_time | etag | ttl | expire_time | replication | labels | annotations | topics | version_aliases | title | akas > +----------+---------------------------+------------------+--------+---------------------------+-----------------------------------------------------------+---------------+-----------------+--------+-----------------+----------------------------------------+-----------> | testew34 | 2024-05-29T19:01:26+05:30 | "161997c46740ba" | | 2024-06-29T00:00:00+05:30 | {"userManaged":{"replicas":[{"location":"me-central1"}]}} | | | | | projects/342342523453/secrets/testew34 | ["gcp://se> | test234 | 2024-05-29T18:23:34+05:30 | "16199807b9333b" | | | {"automatic":{}} | {"foo":"bar"} | {"foo1":"bar1"} | | {"v1":"1"} | projects/342342523453/secrets/test234 | ["gcp://se> +----------+---------------------------+------------------+--------+---------------------------+-----------------------------------------------------------+---------------+-----------------+--------+-----------------+----------------------------------------+-----------> Time: 1.1s. Rows returned: 2. Rows fetched: 2. Hydrate calls: 2. Scans: 1) gcp_secret_manager_secret.gcp: Time: 1.1s. Fetched: 2. Hydrates: 2. > select * from gcp_secret_manager_secret where name = 'testew34' +----------+---------------------------+------------------+--------+---------------------------+-----------------------------------------------------------+--------+-------------+--------+-----------------+----------------------------------------+----------------------> | name | create_time | etag | ttl | expire_time | replication | labels | annotations | topics | version_aliases | title | akas > +----------+---------------------------+------------------+--------+---------------------------+-----------------------------------------------------------+--------+-------------+--------+-----------------+----------------------------------------+----------------------> | testew34 | 2024-05-29T19:01:26+05:30 | "161997c46740ba" | | 2024-06-29T00:00:00+05:30 | {"userManaged":{"replicas":[{"location":"me-central1"}]}} | | | | | projects/342342523453/secrets/testew34 | ["gcp://secretmanager> +----------+---------------------------+------------------+--------+---------------------------+-----------------------------------------------------------+--------+-------------+--------+-----------------+----------------------------------------+----------------------> Time: 36ms. Rows returned: 1. Rows fetched: 2 (cached). Hydrate calls: 0. ```