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_storage_container. closes #69 #71

Merged
merged 11 commits into from
Apr 8, 2021
Merged

Add table azure_storage_container. closes #69 #71

merged 11 commits into from
Apr 8, 2021

Conversation

bigdatasourav
Copy link
Contributor

@bigdatasourav bigdatasourav commented Mar 31, 2021

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_storage_container []

PRETEST: tests/azure_storage_container

TEST: tests/azure_storage_container
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/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330]
azurerm_storage_account.named_test_resource: Creating...
azurerm_storage_account.named_test_resource: Still creating... [10s elapsed]
azurerm_storage_account.named_test_resource: Still creating... [20s elapsed]
azurerm_storage_account.named_test_resource: Still creating... [30s elapsed]
azurerm_storage_account.named_test_resource: Creation complete after 33s [id=/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330/providers/Microsoft.Storage/storageAccounts/turbottest76330]
azurerm_storage_container.named_test_resource: Creating...
azurerm_storage_container.named_test_resource: Creation complete after 0s [id=https://turbottest76330.blob.core.windows.net/turbottest76330]

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: 3 added, 0 changed, 0 destroyed.

Outputs:

resource_aka = azure:///subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330/providers/Microsoft.Storage/storageAccounts/turbottest76330/blobServices/default/containers/turbottest76330
resource_aka_lower = azure:///subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourcegroups/turbottest76330/providers/microsoft.storage/storageaccounts/turbottest76330/blobservices/default/containers/turbottest76330
resource_id = /subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330/providers/Microsoft.Storage/storageAccounts/turbottest76330/blobServices/default/containers/turbottest76330
resource_name = turbottest76330
subscription_id = 3510ae4d-530b-497d-8f30-53b9616fc6c1

Running SQL query: test-get-query.sql
[
  {
    "account_name": "turbottest76330",
    "deleted": false,
    "deny_encryption_scope_override": false,
    "has_immutability_policy": false,
    "has_legal_hold": false,
    "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330/providers/Microsoft.Storage/storageAccounts/turbottest76330/blobServices/default/containers/turbottest76330",
    "lease_duration": "",
    "lease_state": "Available",
    "lease_status": "Unlocked",
    "name": "turbottest76330",
    "public_access": "None",
    "remaining_retention_days": 0,
    "resource_group": "turbottest76330",
    "subscription_id": "3510ae4d-530b-497d-8f30-53b9616fc6c1",
    "type": "Microsoft.Storage/storageAccounts/blobServices/containers",
    "version": null
  }
]
✔ PASSED

Running SQL query: test-hydrate-query.sql
[
  {
    "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330/providers/Microsoft.Storage/storageAccounts/turbottest76330/blobServices/default/containers/turbottest76330",
    "name": "turbottest76330"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330/providers/Microsoft.Storage/storageAccounts/turbottest76330/blobServices/default/containers/turbottest76330",
    "name": "turbottest76330"
  }
]
✔ PASSED

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

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "azure:///subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbottest76330/providers/Microsoft.Storage/storageAccounts/turbottest76330/blobServices/default/containers/turbottest76330",
      "azure:///subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourcegroups/turbottest76330/providers/microsoft.storage/storageaccounts/turbottest76330/blobservices/default/containers/turbottest76330"
    ],
    "title": "turbottest76330"
  }
]
✔ PASSED

POSTTEST: tests/azure_storage_container

TEARDOWN: tests/azure_storage_container

SUMMARY:

1/1 passed.

Example query results

Results
> select name,id,type,account_name from azure_storage_container;
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| name                      | id                                                                                                                                                                            
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| insights-operational-logs | /subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Storage/storageAccounts/test1234qw/blobServices/default/containers/insights-o
| insights-activity-logs    | /subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Storage/storageAccounts/test1234qw/blobServices/default/containers/insights-a
+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 
> select
  name,
  id,
  type,
  account_name
from
  azure_storage_container
where
  public_access = 'None';
+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------
| name | id                                                                                                                                                                      | type                     
+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------
| test | /subscriptions/3510ae4d-530b-497d-8f30-53b9616fc6c1/resourceGroups/turbot_rg/providers/Microsoft.Storage/storageAccounts/test123aq/blobServices/default/containers/test | Microsoft.Storage/storage
+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------

select
  name,
  id,
  type,
  account_name
from
  azure_storage_container
where
  has_legal_hold
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name           | id                                                                                                                                                                                      |
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test-container | /subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/resourceGroups/turbot_rg/providers/Microsoft.Storage/storageAccounts/turbotrgdiag332/blobServices/default/containers/test-container |
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

select
name,
id,
type,
account_name
from
azure_storage_container
where
lease_duration = 'Infinite';
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | id |
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test-container | /subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/resourceGroups/turbot_rg/providers/Microsoft.Storage/storageAccounts/turbotrgdiag332/blobServices/default/containers/test-container |
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

select
name,
id,
type,
account_name
from
azure_storage_container
where
lease_state = 'Leased'
or lease_state = 'Broken';
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | id |
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test-container | /subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/resourceGroups/turbot_rg/providers/Microsoft.Storage/storageAccounts/turbotrgdiag332/blobServices/default/containers/test-container |
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

This was linked to issues Mar 31, 2021
azure/plugin.go Outdated Show resolved Hide resolved
azure/utils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Subhajit97 Subhajit97 left a comment

Choose a reason for hiding this comment

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

Make suggested changes

azure/utils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Subhajit97 Subhajit97 left a comment

Choose a reason for hiding this comment

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

@bigdatasourav There are few more changes required. Please see comments, thanks!

Copy link
Contributor

@Subhajit97 Subhajit97 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.

Pls implement the changes
API link to test

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

@cbruno10 cbruno10 merged commit 1b4e8b4 into main Apr 8, 2021
@cbruno10 cbruno10 deleted the issue-69 branch April 8, 2021 14:37
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_storage_container Add Azure monitor table
4 participants