Control: KMS Crypto keys should have prevent destroy enabled
Description
CryptoKeys cannot be deleted from Google Cloud Platform. Destroying a Terraform-managed CryptoKey will remove it from state and delete all CryptoKeyVersions, rendering the key unusable, but will not delete the resource from the project. When Terraform destroys these keys, any data previously encrypted with these keys will be irrecoverable. For this reason, it is strongly recommended that you add lifecycle hooks to the resource to prevent accidental destruction.
Usage
Run the control in your terminal:
powerpipe control run terraform_gcp_compliance.control.kms_key_prevent_destroy_enabled
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_gcp_compliance.control.kms_key_prevent_destroy_enabled --share
SQL
This control uses a named query:
kms_key_prevent_destroy_enabled