✨ Features
feat: replicate SSE-KMS state objects and make delete-marker replication optional @jamengual (#200)
## what-
New input
s3_replica_kms_key_arn(defaultnull). When set, the replication rule addssource_selection_criteria.sse_kms_encrypted_objectsanddestination.encryption_configuration.replica_kms_key_id. The replication role also gets two statements:kms:Decrypton the source objectskms:Encryptandkms:GenerateDataKeyon the replica key
Both statements are scoped by
kms:ViaService(s3.*.amazonaws.com) and by theaws:s3:arnencryption context of each bucket. -
New input
s3_replication_delete_marker_enabled(defaulttrue, the current behavior) setsdelete_marker_replication.status. -
README.yaml: SSE-KMS and delete-marker notes in the Bucket Replication section.
why
- With
sse_encryption = "aws:kms"the state objects are SSE-KMS, and S3 skips SSE-KMS objects unless the rule opts in and names a replica key (docs). Todays3_replication_enabled = trueon such a bucket creates the configuration but replicates no state. Callers then manage replication outside the module, and since a bucket has one replication configuration, that means turning the module's replication off. - A disaster-recovery copy of state is often meant to survive a delete in the source. With delete markers always replicated, a deleted state object is hidden in the replica too.
references
terraform validatepasses. No behavior change with the new inputs unset.- A follow-up PR to
cloudposse-terraform-components/aws-tfstate-backendwill expose these inputs.