output "key_arn" { description = "The key. Give its ARN to the services that should encrypt with it." value = aws_kms_key.this.arn } output "alias" { description = "The alias, which stays the same when the key rotates." value = aws_kms_alias.this.name } output "enabled" { description = "Whether the key is switched on." value = var.enabled } output "alert_topic_arn" { description = "SNS topic for key changes. Subscribe a chat integration or pager here." value = aws_sns_topic.key_changes.arn } output "verify" { description = "Encrypt, switch the key off, watch decrypt fail, switch it back on. Run as an administrator." value = <<-EOT aws kms encrypt --key-id ${aws_kms_alias.this.name} --plaintext fileb://<(printf hello) --query CiphertextBlob --output text > secret.b64 aws kms disable-key --key-id ${aws_kms_key.this.key_id} aws kms decrypt --ciphertext-blob fileb://<(base64 -d secret.b64) # must fail with DisabledException aws kms enable-key --key-id ${aws_kms_key.this.key_id} EOT }