Interview Prep/Terraform/State and Backends in Production

How do you rotate the KMS key used for state encryption?

IntermediateProductionState and Backends in Production
Answer

Enable automatic key rotation on the KMS key (the key ID stays the same, so Terraform needs no change). To switch to a different key, update kms_key_id, and re-encrypt existing objects by copying them in place (aws s3 cp with the new key) since S3 does not re-encrypt automatically.

All Terraform questions Roadmap: Terraform in production

More on State and Backends in Production