Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table azure_container_registry. Closes #195 #196

Merged
merged 2 commits into from
Jul 26, 2021
Merged

Conversation

Subhajit97
Copy link
Contributor

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 300

SETUP: tests/azure_container_registry []

PRETEST: tests/azure_container_registry

TEST: tests/azure_container_registry
Running terraform
data.azurerm_client_config.current: Refreshing state...
data.null_data_source.resource: Refreshing state...
azurerm_resource_group.named_test_resource: Creating...
azurerm_resource_group.named_test_resource: Creation complete after 2s [id=/subscriptions/********-****-****-****-************/resourceGroups/turbottest86148]
azurerm_container_registry.named_test_resource: Creating...
azurerm_container_registry.named_test_resource: Still creating... [10s elapsed]
azurerm_container_registry.named_test_resource: Creation complete after 17s [id=/subscriptions/********-****-****-****-************/resourceGroups/turbottest86148/providers/Microsoft.ContainerRegistry/registries/turbottest86148]

Warning: Deprecated 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


Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

Outputs:

location = eastus
login_server = turbottest86148.azurecr.io
resource_aka = azure:///subscriptions/********-****-****-****-************/resourceGroups/turbottest86148/providers/Microsoft.ContainerRegistry/registries/turbottest86148
resource_aka_lower = azure:///subscriptions/********-****-****-****-************/resourcegroups/turbottest86148/providers/microsoft.containerregistry/registries/turbottest86148
resource_id = /subscriptions/********-****-****-****-************/resourceGroups/turbottest86148/providers/Microsoft.ContainerRegistry/registries/turbottest86148
resource_name = turbottest86148
subscription_id = ********-****-****-****-************

Running SQL query: test-get-query.sql
[
  {
    "admin_user_enabled": false,
    "data_endpoint_enabled": false,
    "encryption": {
      "status": "disabled"
    },
    "id": "/subscriptions/********-****-****-****-************/resourceGroups/turbottest86148/providers/Microsoft.ContainerRegistry/registries/turbottest86148",
    "login_server": "turbottest86148.azurecr.io",
    "name": "turbottest86148",
    "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
[
  {
    "id": "/subscriptions/********-****-****-****-************/resourceGroups/turbottest86148/providers/Microsoft.ContainerRegistry/registries/turbottest86148",
    "name": "turbottest86148"
  }
]
✔ PASSED

Running SQL query: test-not-found-query.sql
null
✔ PASSED

Running SQL query: test-turbot-query.sql
[
  {
    "id": "/subscriptions/********-****-****-****-************/resourceGroups/turbottest86148/providers/Microsoft.ContainerRegistry/registries/turbottest86148",
    "name": "turbottest86148",
    "region": "eastus",
    "resource_group": "turbottest86148",
    "subscription_id": "********-****-****-****-************",
    "title": "turbottest86148"
  }
]
✔ PASSED

POSTTEST: tests/azure_container_registry

TEARDOWN: tests/azure_container_registry

SUMMARY:

1/1 passed.

Example query results

Results

Basic info

select
  name,
  id,
  provisioning_state,
  creation_date,
  sku_tier,
  region
from
  azure_container_registry;
+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+---------------------+----------+--------+
| name        | id                                                                                                                                                 | provisioning_state | creation_date       | sku_tier | region |
+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+---------------------+----------+--------+
| steampipe01 | /subscriptions/********-****-****-****-************/resourceGroups/turbot_rg/providers/Microsoft.ContainerRegistry/registries/testsubhajit23072021 | Succeeded          | 2021-07-23 06:57:12 | Standard | eastus |
+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------+--------------------+---------------------+----------+--------+

List registries not encrypted with a customer-managed key

select
  name,
  encryption ->> 'status' as encryption_status,
  region
from
  azure_container_registry;
+-------------+-------------------+--------+
| name        | encryption_status | region |
+-------------+-------------------+--------+
| steampipe01 | disabled          | eastus |
+-------------+-------------------+--------+

List registries not configured with virtual network service endpoint

select
  name,
  network_rule_set ->> 'defaultAction' as network_rule_default_action,
  network_rule_set ->> 'virtualNetworkRules' as virtual_network_rules
from
  azure_container_registry
where
  network_rule_set is not null
  and network_rule_set ->> 'defaultAction' = 'Allow';
+-----------------+-----------------------------+-----------------------+
| name            | network_rule_default_action | virtual_network_rules |
+-----------------+-----------------------------+-----------------------+
| steampipetest01 | Allow                       | []                    |
+-----------------+-----------------------------+-----------------------+

List registries with admin user account enabled

select
  name,
  admin_user_enabled,
  region
from
  azure_container_registry
where
  admin_user_enabled;
+-----------------+--------------------+--------+
| name            | admin_user_enabled | region |
+-----------------+--------------------+--------+
| steampipetest01 | true               | eastus |
+-----------------+--------------------+--------+

@Subhajit97 Subhajit97 requested a review from bigdatasourav July 23, 2021 10:48
@Subhajit97 Subhajit97 self-assigned this Jul 23, 2021
@Subhajit97 Subhajit97 linked an issue Jul 23, 2021 that may be closed by this pull request
Copy link
Contributor

@bigdatasourav bigdatasourav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@rajlearner17 rajlearner17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bigdatasourav bigdatasourav merged commit 7e45b69 into main Jul 26, 2021
@bigdatasourav bigdatasourav deleted the issue-195 branch July 26, 2021 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table azure_container_registry
3 participants