Description
For a new secret, Secrets Manager encrypts the value under the AWS managed aws/secretsmanager key when kms_key_id is omitted. Choose a customer managed key if you need to control its policy and lifecycle.
Potential impact
Excessive read permissions can expose the secret regardless of which key encrypts it.
Remediation
Set kms_key_id to the symmetric encryption key’s ARN or alias and check both secret-read and KMS permissions. After a key change, test access to every required version. Keep access to the old key while any of those versions still depend on it.
Examples
Use the default key
resource "aws_secretsmanager_secret" "example" {
name = "example"
}
Specify a key
resource "aws_secretsmanager_secret" "example" {
name = "example"
kms_key_id = "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
}
Both declarations create secret metadata. Replace the example ARN in the second with your customer managed key ARN.