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

azurerm_key_vault_key - handling the parent Key Vault being deleted #1535

Merged
merged 2 commits into from
Jul 11, 2018

Conversation

tombuildsstuff
Copy link
Contributor

Currently Key Vault Key's don't detect that the parent Key Vault has been deleted during the refresh, and so they fail:

* azurerm_key_vault_key.dckey: azurerm_key_vault_key.dckey: keyvault.BaseClient#GetKey: Failure sending request: StatusCode=0 -- Original Error: Get https://east2-kv.vault.azure.net/keys/DCKey/?api-version=2016-10-01: dial tcp: lookup east2-kv.vault.azure.net: no such host

Fixes #1240

Key Vault tests pass:

$ acctests azurerm TestAccAzureRMKeyVault_disappears
=== RUN   TestAccAzureRMKeyVault_disappears
--- PASS: TestAccAzureRMKeyVault_disappears (193.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	193.059s

Key Vault Certificate tests pass:

$ acctests azurerm TestAccAzureRMKeyVaultCertificate_disappears

=== RUN   TestAccAzureRMKeyVaultCertificate_disappears
--- PASS: TestAccAzureRMKeyVaultCertificate_disappears (234.06s)
=== RUN   TestAccAzureRMKeyVaultCertificate_disappearsWhenParentKeyVaultDeleted
--- PASS: TestAccAzureRMKeyVaultCertificate_disappearsWhenParentKeyVaultDeleted (214.36s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	448.453s

Key Vault Key tests pass:

$ acctests azurerm TestAccAzureRMKeyVaultKey_disappears

=== RUN   TestAccAzureRMKeyVaultKey_disappears
--- PASS: TestAccAzureRMKeyVaultKey_disappears (201.67s)
=== RUN   TestAccAzureRMKeyVaultKey_disappearsWhenParentKeyVaultDeleted
--- PASS: TestAccAzureRMKeyVaultKey_disappearsWhenParentKeyVaultDeleted (197.12s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	398.835s

Key Vault Secret tests pass:

$ acctests azurerm TestAccAzureRMKeyVaultSecret_disappears
=== RUN   TestAccAzureRMKeyVaultSecret_disappears
--- PASS: TestAccAzureRMKeyVaultSecret_disappears (196.76s)
=== RUN   TestAccAzureRMKeyVaultSecret_disappearsWhenParentKeyVaultDeleted
--- PASS: TestAccAzureRMKeyVaultSecret_disappearsWhenParentKeyVaultDeleted (196.75s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	393.541s

… deleted

Also adds tests for the other resources
@tombuildsstuff tombuildsstuff added this to the 1.9.0 milestone Jul 11, 2018
@tombuildsstuff tombuildsstuff requested a review from a team July 11, 2018 07:03
@@ -174,6 +174,11 @@ func resourceArmKeyVaultKeyRead(d *schema.ResourceData, meta interface{}) error

resp, err := client.GetKey(ctx, id.KeyVaultBaseUrl, id.Name, "")
if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")

Choose a reason for hiding this comment

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

It'd be great to log that we're removing the key from state because it wasn't found.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@tombuildsstuff tombuildsstuff merged commit aaa82af into master Jul 11, 2018
@tombuildsstuff tombuildsstuff deleted the key-vault-key-deletion branch July 11, 2018 12:45
tombuildsstuff added a commit that referenced this pull request Jul 11, 2018
torresdal added a commit to torresdal/terraform-provider-azurerm that referenced this pull request Aug 25, 2018
* api-management:
  Updating to include hashicorp#1565
  resource/servicebus_subscription_rule: Fix the correlation_filter optional values (hashicorp#1565)
  Updating to include hashicorp#1563
  resouce/app_insights: Allow different application_type deployments (hashicorp#1563)
  VMSS: changed sku property from a set to list
  Update CHANGELOG.md to include hashicorp#1552
  Renamed azurerm_azuread_application.html.markdown to azuread_application.html.markdown
  New Data Source: `azurerm_azuread_application`
  VMSS: Updating the code samples to be valid. Fixes hashicorp#1539 (hashicorp#1549)
  Creation Data -> Creation Date (hashicorp#1548)
  Updating to include hashicorp#1546
  Workaround upstream issue in creating azureEndpoints in traffic manager (hashicorp#1546)
  Cleanup after v1.9.0 release
  v1.9.0
  Updating to include hashicorp#1269
  New Resource: `azurerm_azuread_application` (hashicorp#1269)
  Remove tags validate in preConfig of TestAccAzureRMKeyVault_update (hashicorp#1534)
  Updating to include hashicorp#1535
  `azurerm_key_vault_key` - handling the parent Key Vault being deleted (hashicorp#1535)
@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refreshing state of a Key from a non-existing Azure Key Vault fails
2 participants