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 lifecycle_management_policy details for storage account. Closes #146 #155

Merged
merged 3 commits into from
Jun 30, 2021

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

PRETEST: tests/azure_storage_account

TEST: tests/azure_storage_account
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 3s [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097]
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/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097/providers/Microsoft.Storage/storageAccounts/turbottest43097]

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:

resource_aka = azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097/providers/Microsoft.Storage/storageAccounts/turbottest43097
resource_aka_lower = azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/turbottest43097/providers/microsoft.storage/storageaccounts/turbottest43097
resource_id = /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097/providers/Microsoft.Storage/storageAccounts/turbottest43097
resource_name = turbottest43097

Running SQL query: test-get-query.sql
[
  {
    "access_tier": "Cool",
    "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097/providers/Microsoft.Storage/storageAccounts/turbottest43097",
    "kind": "StorageV2",
    "name": "turbottest43097",
    "sku_name": "Standard_LRS",
    "sku_tier": "Standard"
  }
]
✔ PASSED

Running SQL query: test-hydrate-query.sql
[
  {
    "access_tier": "Cool",
    "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097/providers/Microsoft.Storage/storageAccounts/turbottest43097",
    "name": "turbottest43097"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097/providers/Microsoft.Storage/storageAccounts/turbottest43097",
    "name": "turbottest43097"
  }
]
✔ PASSED

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

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest43097/providers/Microsoft.Storage/storageAccounts/turbottest43097",
      "azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/turbottest43097/providers/microsoft.storage/storageaccounts/turbottest43097"
    ],
    "tags": {
      "name": "turbottest43097"
    },
    "title": "turbottest43097"
  }
]
✔ PASSED

POSTTEST: tests/azure_storage_account

TEARDOWN: tests/azure_storage_account

SUMMARY:

1/1 passed.

Example query results

Results

List storage accounts without lifecycle

select
  name,
  lifecycle_management_policy -> 'properties' -> 'policy' -> 'rules' as lifecycle_rules
from
  azure_storage_account
where
  lifecycle_rules is null;
+--------------------------+-----------------+
| name                     | lifecycle_rules |
+--------------------------+-----------------+
| testsumitstorageaccount1 | <null>          |
| sqlvaskpahgwu6znae       | <null>          |
| testsumitstorageclassic  | <null>          |
+--------------------------+-----------------+

@Subhajit97 Subhajit97 requested a review from LalitLab June 29, 2021 15:44
@Subhajit97 Subhajit97 self-assigned this Jun 29, 2021
@Subhajit97 Subhajit97 linked an issue Jun 29, 2021 that may be closed by this pull request
Copy link
Contributor

@LalitLab LalitLab left a comment

Choose a reason for hiding this comment

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

LGTM

@LalitLab LalitLab merged commit 241de87 into main Jun 30, 2021
@LalitLab LalitLab deleted the issue-146 branch June 30, 2021 07:56
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 lifecycle management1 details for storage account.
2 participants