[Bug] Custom KMS Org policy breaks terraform destroy operations of KMS keys #9
Description
This constraint fails when terraform tries to delete a key. When the GCP provider deletes a key version, it also explicitly unsets the key rotation period to prevent a new key from being created. See https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/templates/terraform/custom_delete/kms_crypto_key.tmpl
This is due to the unique feature of KMS where it is impossible to delete a keyring or key, key material can only be destroyed.
Currently my only workaround is to disable this constraint if I need to delete a key, or remove the old key from terraform state files. It would be nice if the org policy could handle this challenge gracefully. I submitted a separate issue to potentially modify this behavior within the terraform provider itself, but it looks to be by design, so I am doubtful this will get changed on the provider side. hashicorp/terraform-provider-google#24503
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(org-policies): allow KMS key destroy, gate requireOsLogin by reg…
feat(org-policies): allow KMS key destroy, gate requireOsLogin by reg…
feat(org-policies): allow KMS key destroy, gate requireOsLogin by reg…
feat(org-policies): allow KMS key destroy, gate requireOsLogin by reg…
feat(org-policies): allow KMS key destroy, gate requireOsLogin by reg…
2 remaining items
fix(0-bootstrap): scope custom.kmsRotation to CREATE so key destroy s…
fix(0-bootstrap): scope custom.kmsRotation to CREATE so key destroy s…
fix(0-bootstrap): scope custom.kmsRotation to CREATE so key destroy s…
fix(0-bootstrap): scope custom.kmsRotation to CREATE so key destroy s…
fix(0-bootstrap): scope custom.kmsRotation to CREATE so key destroy s…
fix(0-bootstrap): scope custom.kmsRotation to CREATE so key destroy s…
fix(0-bootstrap): use DENY condition on custom.kmsRotation so key des…
fix(0-bootstrap): use DENY condition on custom.kmsRotation so key des…
fix(0-bootstrap): use DENY condition on custom.kmsRotation so key des…
fix(0-bootstrap): use DENY condition on custom.kmsRotation so key des…
fix(0-bootstrap): use DENY condition on custom.kmsRotation so key des…