turbot / steampipe-plugin-azure

Use SQL to instantly query Azure resources across regions and subscriptions. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/azure
Apache License 2.0
37 stars 17 forks source link

Add webhook details in table azure_container_registry Closes #708 #710

Closed ParthaI closed 9 months ago

ParthaI commented 9 months 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/azure_container_registry [] PRETEST: tests/azure_container_registry TEST: tests/azure_container_registry Running terraform data.azurerm_client_config.current: Reading... data.azurerm_client_config.current: Read complete after 0s [id=Y2xpZW50Q29uZmlncy9jbGllbnRJZD0wNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDY7b2JqZWN0SWQ9MDZmZDQ2YjAtYTg2Ny00OWExLWE0ZjEtZjc3Njg0NjVjYWJhO3N1YnNjcmlwdGlvbklkPWQ0NmQ3NDE2LWY5NWYtNDc3MS1iYmI1LTUyOWQ0Yzc2NjU5Yzt0ZW5hbnRJZD1jZGZmZDcwOC03ZGEwLTRjZWEtYWJlYi0wYTRjMzM0ZDdmNjQ=] data.null_data_source.resource: Reading... data.null_data_source.resource: Read complete after 0s [id=static] 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: # azurerm_container_registry.named_test_resource will be created + resource "azurerm_container_registry" "named_test_resource" { + admin_enabled = false + admin_password = (sensitive value) + admin_username = (known after apply) + encryption = (known after apply) + export_policy_enabled = true + id = (known after apply) + location = "eastus" + login_server = (known after apply) + name = "turbottest53515" + network_rule_bypass_option = "AzureServices" + network_rule_set = (known after apply) + public_network_access_enabled = true + resource_group_name = "turbottest53515" + retention_policy = (known after apply) + sku = "Premium" + tags = { + "name" = "turbottest53515" } + trust_policy = (known after apply) + zone_redundancy_enabled = false } # azurerm_resource_group.named_test_resource will be created + resource "azurerm_resource_group" "named_test_resource" { + id = (known after apply) + location = "eastus" + name = "turbottest53515" } Plan: 2 to add, 0 to change, 0 to destroy. Changes to Outputs: + location = "eastus" + login_server = (known after apply) + resource_aka = (known after apply) + resource_aka_lower = (known after apply) + resource_id = (known after apply) + resource_name = "turbottest53515" + subscription_id = "3510ae4d-530b-497d-8f30-53b9616fc6c1" azurerm_resource_group.named_test_resource: Creating... azurerm_resource_group.named_test_resource: Creation complete after 4s [id=/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest53515] azurerm_container_registry.named_test_resource: Creating... azurerm_container_registry.named_test_resource: Still creating... [10s elapsed] azurerm_container_registry.named_test_resource: Still creating... [20s elapsed] azurerm_container_registry.named_test_resource: Creation complete after 26s [id=/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest53515/providers/Microsoft.ContainerRegistry/registries/turbottest53515] Warning: Deprecated with data.null_data_source.resource, on variables.tf line 28, in data "null_data_source" "resource": 28: 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: 2 added, 0 changed, 0 destroyed. Outputs: location = "eastus" login_server = "turbottest53515.azurecr.io" resource_aka = "azure:///subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest53515/providers/Microsoft.ContainerRegistry/registries/turbottest53515" resource_aka_lower = "azure:///subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourcegroups/turbottest53515/providers/microsoft.containerregistry/registries/turbottest53515" resource_id = "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest53515/providers/Microsoft.ContainerRegistry/registries/turbottest53515" resource_name = "turbottest53515" subscription_id = "3510ae4d-530b-497d-8f30-53b9616fc6c1" Running SQL query: test-get-query.sql Warning: terminal options has been deprecated and will be removed in a future version of Steampipe. These can now be set in a steampipe workspace. (/Users/parthas/.steampipe/config/default.spc:34,20-42,2) [ { "admin_user_enabled": false, "data_endpoint_enabled": false, "encryption": { "status": "disabled" }, "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest53515/providers/Microsoft.ContainerRegistry/registries/turbottest53515", "login_server": "turbottest53515.azurecr.io", "name": "turbottest53515", "network_rule_bypass_options": "AzureServices", "policies": { "quarantinePolicy": { "status": "disabled" }, "retentionPolicy": { "days": 7, "status": "disabled" }, "trustPolicy": { "status": "disabled", "type": "Notary" } }, "provisioning_state": "Succeeded", "public_network_access": "Enabled", "sku_name": "Premium", "sku_tier": "Premium", "type": "Microsoft.ContainerRegistry/registries", "zone_redundancy": "Disabled" } ] ✔ PASSED Running SQL query: test-list-query.sql Warning: terminal options has been deprecated and will be removed in a future version of Steampipe. These can now be set in a steampipe workspace. (/Users/parthas/.steampipe/config/default.spc:34,20-42,2) [ { "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest53515/providers/Microsoft.ContainerRegistry/registries/turbottest53515", "name": "turbottest53515" } ] ✔ PASSED Running SQL query: test-not-found-query.sql Warning: terminal options has been deprecated and will be removed in a future version of Steampipe. These can now be set in a steampipe workspace. (/Users/parthas/.steampipe/config/default.spc:34,20-42,2) [] ✔ PASSED Running SQL query: test-turbot-query.sql Warning: terminal options has been deprecated and will be removed in a future version of Steampipe. These can now be set in a steampipe workspace. (/Users/parthas/.steampipe/config/default.spc:34,20-42,2) [ { "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest53515/providers/Microsoft.ContainerRegistry/registries/turbottest53515", "name": "turbottest53515", "region": "eastus", "resource_group": "turbottest53515", "subscription_id": "3510ae4d-530b-497d-8f30-53b9616fc6c1", "title": "turbottest53515" } ] ✔ PASSED TEARDOWN: tests/azure_container_registry SUMMARY: 1/1 passed. ```

Example query results

Results ``` > select name, w ->> 'location' as webhook_location, w -> 'properties' -> 'actions' as actions, w -> 'properties' ->> 'scope' as scope, w -> 'properties' ->> 'status' as status from azure_container_registry, jsonb_array_elements(webhooks) as w; +------------+------------------+----------+-----------+---------+ | name | webhook_location | actions | scope | status | +------------+------------------+----------+-----------+---------+ | TEST123653 | eastus | ["push"] | testing43 | enabled | +------------+------------------+----------+-----------+---------+ Time: 1.3s. Rows fetched: 1. Hydrate calls: 1. > select name, webhooks from azure_container_registry +------------+------------------------------------------------------------------------------------------------------------+ | name | webhooks | +------------+------------------------------------------------------------------------------------------------------------+ | TEST123653 | [{"location":"eastus","properties":{"actions":["push"],"scope":"testing43","status":"enabled"},"tags":{}}] | +------------+------------------------------------------------------------------------------------------------------------+ Time: 2.5s. Rows fetched: 1. Hydrate calls: 1. ```