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_servicebus_namespace. Closes #198 #200

Merged
merged 3 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_servicebus_namespace []

PRETEST: tests/azure_servicebus_namespace

TEST: tests/azure_servicebus_namespace
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/turbottest68877]
azurerm_servicebus_namespace.named_test_resource: Creating...
azurerm_servicebus_namespace.named_test_resource: Still creating... [10s elapsed]
azurerm_servicebus_namespace.named_test_resource: Still creating... [20s elapsed]
azurerm_servicebus_namespace.named_test_resource: Still creating... [30s elapsed]
azurerm_servicebus_namespace.named_test_resource: Still creating... [40s elapsed]
azurerm_servicebus_namespace.named_test_resource: Still creating... [50s elapsed]
azurerm_servicebus_namespace.named_test_resource: Still creating... [1m0s elapsed]
azurerm_servicebus_namespace.named_test_resource: Still creating... [1m10s elapsed]
azurerm_servicebus_namespace.named_test_resource: Creation complete after 1m13s [id=/subscriptions/********-****-****-****-************/resourceGroups/turbottest68877/providers/Microsoft.ServiceBus/namespaces/turbottest68877]

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
resource_aka = azure:///subscriptions/********-****-****-****-************/resourceGroups/turbottest68877/providers/Microsoft.ServiceBus/namespaces/turbottest68877
resource_aka_lower = azure:///subscriptions/********-****-****-****-************/resourcegroups/turbottest68877/providers/microsoft.servicebus/namespaces/turbottest68877
resource_id = /subscriptions/********-****-****-****-************/resourceGroups/turbottest68877/providers/Microsoft.ServiceBus/namespaces/turbottest68877
resource_name = turbottest68877
subscription_id = ********-****-****-****-************

Running SQL query: test-get-query.sql
[
  {
    "encryption": null,
    "id": "/subscriptions/********-****-****-****-************/resourceGroups/turbottest68877/providers/Microsoft.ServiceBus/namespaces/turbottest68877",
    "name": "turbottest68877",
    "network_rule_set": {
      "properties": {
        "defaultAction": "Deny",
        "ipRules": [],
        "virtualNetworkRules": []
      }
    },
    "provisioning_state": "Succeeded",
    "servicebus_endpoint": "https://turbottest68877.servicebus.windows.net:443/",
    "sku_name": "Basic",
    "sku_tier": "Basic",
    "type": "Microsoft.ServiceBus/Namespaces",
    "zone_redundant": false
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/********-****-****-****-************/resourceGroups/turbottest68877/providers/Microsoft.ServiceBus/namespaces/turbottest68877",
    "name": "turbottest68877"
  }
]
✔ PASSED

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

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "azure:///subscriptions/********-****-****-****-************/resourceGroups/turbottest68877/providers/Microsoft.ServiceBus/namespaces/turbottest68877",
      "azure:///subscriptions/********-****-****-****-************/resourcegroups/turbottest68877/providers/microsoft.servicebus/namespaces/turbottest68877"
    ],
    "id": "/subscriptions/********-****-****-****-************/resourceGroups/turbottest68877/providers/Microsoft.ServiceBus/namespaces/turbottest68877",
    "name": "turbottest68877",
    "region": "eastus",
    "resource_group": "turbottest68877",
    "subscription_id": "********-****-****-****-************",
    "tags": {
      "name": "turbottest68877"
    },
    "title": "turbottest68877"
  }
]
✔ PASSED

POSTTEST: tests/azure_servicebus_namespace

TEARDOWN: tests/azure_servicebus_namespace

SUMMARY:

1/1 passed.

Example query results

Results

Basic info

select
  name,
  id,
  sku_tier,
  provisioning_state,
  created_at
from
  azure_servicebus_namespace;
+-------------+------------------------------------------------------------------------------------------------------------------------------------+----------+--------------------+---------------------+
| name        | id                                                                                                                                 | sku_tier | provisioning_state | created__at         |
+-------------+------------------------------------------------------------------------------------------------------------------------------------+----------+--------------------+---------------------+
| steampipe01 | /subscriptions/********-****-****-****-************/resourceGroups/turbot_rg/providers/Microsoft.ServiceBus/namespaces/steampipe01 | Basic    | Succeeded          | 2021-07-23 13:26:40 |
+-------------+------------------------------------------------------------------------------------------------------------------------------------+----------+--------------------+---------------------+

List premium namespaces

select
  name,
  sku_tier,
  region
from
  azure_servicebus_namespace
where
  sku_tier = 'Premium';
+-------------+----------+---------+
| name        | sku_tier | region  |
+-------------+----------+---------+
| steampipe02 | Premium  | westus2 |
+-------------+----------+---------+

List unencrypted namespaces

select
  name,
  sku_tier,
  encryption
from
  azure_servicebus_namespace
where
  sku_tier = 'Premium'
  and encryption is null;
+-------------+----------+-------------+
| name        | sku_tier | encryption  |
+-------------+----------+-------------+
| steampipe02 | Premium  | <null>      |
+-------------+----------+-------------+

List namespaces not using a virtual network service endpoint

select
  name,
  region,
  network_rule_set -> 'properties' -> 'virtualNetworkRules' as virtual_network_rules
from
  azure_servicebus_namespace
where
  sku_tier = 'Premium'
  and (
    jsonb_array_length(network_rule_set -> 'properties' -> 'virtualNetworkRules') = 0
    or exists (
      select
        * 
      from
        jsonb_array_elements(network_rule_set -> 'properties' -> 'virtualNetworkRules') as t
      where
        t -> 'subnet' ->> 'id' is null
    )
  );
+-------------+----------+-----------------------+
| name        | sku_tier | virtual_network_rules |
+-------------+----------+-----------------------+
| steampipe02 | Premium  | []                    |
+-------------+----------+-----------------------+

@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 49c0d0d into main Jul 26, 2021
@bigdatasourav bigdatasourav deleted the issue-198 branch July 26, 2021 06:57
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_servicebus_namespace
3 participants