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_key_vault_deleted_vault. Closes #262 #263

Merged
merged 4 commits into from
Aug 24, 2021
Merged

Conversation

bigdatasourav
Copy link
Contributor

@bigdatasourav bigdatasourav commented Aug 13, 2021

Integration test logs

Logs
SETUP: tests/azure_key_vault_deleted_vault []

PRETEST: tests/azure_key_vault_deleted_vault

TEST: tests/azure_key_vault_deleted_vault
Running terraform
azurerm_resource_group.named_test_resource: Creating...
azurerm_resource_group.named_test_resource: Creation complete after 5s [id=/subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/resourceGroups/turbottest559]
azurerm_key_vault.named_test_resource: Creating...
azurerm_key_vault.named_test_resource: Still creating... [10s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [20s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [30s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [40s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [50s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [1m0s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [1m10s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [1m20s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [1m30s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [1m40s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [1m50s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [2m0s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [2m10s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [2m20s elapsed]
azurerm_key_vault.named_test_resource: Still creating... [2m30s elapsed]
azurerm_key_vault.named_test_resource: Creation complete after 2m36s [id=/subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/resourceGroups/turbottest559/providers/Microsoft.KeyVault/vaults/turbottest559]
null_resource.named_test_resource: Creating...
null_resource.named_test_resource: Provisioning with 'local-exec'...
null_resource.named_test_resource (local-exec): Executing: ["/bin/sh" "-c" "az keyvault delete --name turbottest559 --resource-group turbottest559"]
null_resource.named_test_resource: Still creating... [10s elapsed]
null_resource.named_test_resource (local-exec): WARNING: Warning! If you have soft-delete protection enabled on this key vault, you will not be able to reuse this key vault name until the key vault has been purged from the soft deleted state. Please see the following documentation for additional guidance.
null_resource.named_test_resource (local-exec): https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview
null_resource.named_test_resource: Provisioning with 'local-exec'...
null_resource.named_test_resource (local-exec): Executing: ["/bin/sh" "-c" "az keyvault list-deleted > /private/var/folders/d8/gsp6f_cn3359xnt_gs3cts_80000gn/T/tests/azure_deleted_key_vault/terraform/test/output.json"]
null_resource.named_test_resource: Still creating... [20s elapsed]
null_resource.named_test_resource: Creation complete after 21s [id=7932574734936461083]
data.local_file.input: Reading...
data.local_file.input: Read complete after 0s [id=9da9adfbc9e91e2a0ee2104bcf32fd29b121b8fa]

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:

region = "eastus"
resource_aka = "azure:///subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest79983"
resource_aka_lower = "azure:///subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/microsoft.keyvault/locations/eastus/deletedvaults/turbottest79983"
resource_id = "/subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest79983"
resource_name = "turbottest79983"
subscription_id = "d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8"

Running SQL query: test-get-query.sql
[
  {
    "id": "/subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest79983",
    "name": "turbottest79983",
    "region": "eastus",
    "resource_group": "turbottest79983",
    "subscription_id": "d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8",
    "type": "Microsoft.KeyVault/deletedVaults"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest79983",
    "name": "turbottest79983",
    "type": "Microsoft.KeyVault/deletedVaults"
  }
]
✔ PASSED

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

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "azure:///subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest79983",
      "azure:///subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/microsoft.keyvault/locations/eastus/deletedvaults/turbottest79983"
    ],
    "name": "turbottest79983",
    "title": "turbottest79983"
  }
]
✔ PASSED

POSTTEST: tests/azure_key_vault_deleted_vault

TEARDOWN: tests/azure_key_vault_deleted_vault

SUMMARY:

1/1 passed.

Example query results

Results
> select
  name,
  id,
  type,
  deletion_date,
  scheduled_purge_date
from
  azure_key_vault_deleted_vault;
+-----------------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------+--------------------
| name            | id                                                                                                                              | type                             | deletion_date      
+-----------------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------+--------------------
| turbottest79983 | /subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest79983 | Microsoft.KeyVault/deletedVaults | 2021-08-13 10:44:31
| turbottest50436 | /subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest50436 | Microsoft.KeyVault/deletedVaults | 2021-08-13 10:44:18
+-----------------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------+--------------------
> select
  name,
  id,
  type,
  deletion_date,
  scheduled_purge_date
from
  azure_key_vault_deleted_vault
where
  scheduled_purge_date > (current_date - interval '1' day);
+-----------------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------+--------------------
| name            | id                                                                                                                              | type                             | deletion_date      
+-----------------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------+--------------------
| turbottest50436 | /subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest50436 | Microsoft.KeyVault/deletedVaults | 2021-08-13 10:44:18
| turbottest79983 | /subscriptions/d7245080-b4ae-4fe5-b6fa-2e71b3dae6c8/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/turbottest79983 | Microsoft.KeyVault/deletedVaults | 2021-08-13 10:44:31
+-----------------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------+--------------------

@bigdatasourav bigdatasourav self-assigned this Aug 13, 2021
@bigdatasourav bigdatasourav linked an issue Aug 13, 2021 that may be closed by this pull request
@bigdatasourav bigdatasourav changed the title Add table azure_deleted_key_vault. Closes #262 Add table azure_key_vault_deleted_vault. Closes #262 Aug 13, 2021
azure/plugin.go Outdated Show resolved Hide resolved
Copy link
Contributor

@khushboo9024 khushboo9024 left a comment

Choose a reason for hiding this comment

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

Please run the integration test again and add logs as the table name got modified.

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 5be4bbf into main Aug 24, 2021
@bigdatasourav bigdatasourav deleted the issue-262 branch August 24, 2021 07:30
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_key_vault_deleted_vault
3 participants