You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Documentation for the purge_soft_delete_on_destroy provider features states that it applies to azurerm_key_vault, azurerm_key_vault_certificate, azurerm_key_vault_key and azurerm_key_vault_secret. We have a use case where we'd like the feature configured differently for azurerm_key_vault versus azurerm_key_vault_certificate, azurerm_key_vault_key and azurerm_key_vault_secret.
I'm setting the purge_soft_delete_on_destroy feature to false to prevent errors when deleting a key vault using an SPN that does not have the subscription level purge permission. However that feature setting causes azurerm_key_vault_certificate replacement to fail when updating an existing certificate even though the SPN has all certificate permissions in the key vault access policy.
Partial output from terraform apply:
Terraform will perform the following actions:
# module.cert.azurerm_key_vault_certificate.pfx must be replaced
-/+ resource "azurerm_key_vault_certificate" "pfx" {
~ certificate_attribute = [
- {
- created = "2021-01-21T19:47:35Z"
- enabled = true
- expires = "2023-01-21T16:46:31Z"
- not_before = "2021-01-21T16:46:31Z"
- recovery_level = "Recoverable+Purgeable"
- updated = "2021-01-21T19:47:35Z"
},
] -> (known after apply)
~ certificate_data = "<cert data>" -> (known after apply)
~ id = "https://a3qarrrkvt03t.vault.azure.net/certificates/RRRTEST-ACME-NET-INTERNAL/6458eeee0afa4e1dae75645e14d51a26" -> (known after apply)
key_vault_id = "/subscriptions/3d66dc2c-7be9-474a-89fe-1a00b0511b0e/resourceGroups/A3QARRRRSG01T/providers/Microsoft.KeyVault/vaults/A3QARRRKVT03T"
name = "RRRTEST-ACME-NET-INTERNAL"
~ secret_id = "https://a3qarrrkvt03t.vault.azure.net/secrets/RRRTEST-ACME-NET-INTERNAL/6458eeee0afa4e1dae75645e14d51a26" -> (known after apply)
tags = {
"Application" = "TFE Dev Integration Testing"
"Application-Code" = "RRR"
"Business-Criticality" = "NA"
"Environment" = "Quality-Assurance"
"Owner" = "rpieterick"
"Owner-Email" = "[email protected]"
}
~ thumbprint = "EB43A3138D5F97C8E57A4AAEFA148A1A1A55C854" -> (known after apply)
~ version = "6458eeee0afa4e1dae75645e14d51a26" -> (known after apply)
~ certificate {
~ contents = (sensitive value)
password = (sensitive value)
}
~ certificate_policy {
issuer_parameters {
name = "Self"
}
key_properties {
exportable = true
key_size = 2048
key_type = "RSA"
reuse_key = false
}
secret_properties {
content_type = "application/x-pkcs12"
}
~ x509_certificate_properties {
~ extended_key_usage = [
- "1.3.6.1.5.5.7.3.2",
- "1.3.6.1.5.5.7.3.1",
] -> (known after apply)
~ key_usage = [
- "digitalSignature",
- "keyEncipherment",
] -> (known after apply)
~ subject = "<subject>" -> (known after apply)
~ validity_in_months = 25 -> (known after apply)
~ subject_alternative_names {
~ dns_names = [
- "rrr-test.acme.net",
- "rrrtest.acme.net",
] -> (known after apply)
~ emails = [] -> (known after apply)
~ upns = [] -> (known after apply)
}
}
}
}
module.cert.azurerm_key_vault_certificate.pfx: Destroying... [id=https://a3qarrrkvt03t.vault.azure.net/certificates/RRRTEST-ACME-NET-INTERNAL/6458eeee0afa4e1dae75645e14d51a26]
module.cert.azurerm_key_vault_certificate.pfx: Still destroying... [id=https://a3qarrrkvt03t.vault.azure.net/c...ERNAL/6458eeee0afa4e1dae75645e14d51a26, 10s elapsed]
module.cert.azurerm_key_vault_certificate.pfx: Destruction complete after 12s
module.cert.azurerm_key_vault_certificate.pfx: Creating...
Error: keyvault.BaseClient#ImportCertificate: Failure responding to request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=409 Code="Conflict" Message="Certificate RRRTEST-ACME-NET-INTERNAL is currently in a deleted but recoverable state, and its name cannot be reused; in this state, the certificate can only be recovered or purged." InnerError={"code":"ObjectIsDeletedButRecoverable"}
on .terraform/modules/cert/keyvault.tf line 24, in resource "azurerm_key_vault_certificate" "pfx":
24: resource "azurerm_key_vault_certificate" "pfx" {
New or Affected Resource(s)
azurerm_key_vault, azurerm_key_vault_certificate, azurerm_key_vault_key and azurerm_key_vault_secret
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Description
Documentation for the purge_soft_delete_on_destroy provider features states that it applies to azurerm_key_vault, azurerm_key_vault_certificate, azurerm_key_vault_key and azurerm_key_vault_secret. We have a use case where we'd like the feature configured differently for azurerm_key_vault versus azurerm_key_vault_certificate, azurerm_key_vault_key and azurerm_key_vault_secret.
I'm setting the purge_soft_delete_on_destroy feature to false to prevent errors when deleting a key vault using an SPN that does not have the subscription level purge permission. However that feature setting causes azurerm_key_vault_certificate replacement to fail when updating an existing certificate even though the SPN has all certificate permissions in the key vault access policy.
Partial output from terraform apply:
New or Affected Resource(s)
Potential Terraform Configuration
References
The text was updated successfully, but these errors were encountered: