github cloudposse/terraform-aws-tfstate-backend v1.10.0

3 hours ago

✨ Features

feat: replicate SSE-KMS state objects and make delete-marker replication optional @jamengual (#200) ## what
  • New input s3_replica_kms_key_arn (default null). When set, the replication rule adds source_selection_criteria.sse_kms_encrypted_objects and destination.encryption_configuration.replica_kms_key_id. The replication role also gets two statements:

    • kms:Decrypt on the source objects
    • kms:Encrypt and kms:GenerateDataKey on the replica key

    Both statements are scoped by kms:ViaService (s3.*.amazonaws.com) and by the aws:s3:arn encryption context of each bucket.

  • New input s3_replication_delete_marker_enabled (default true, the current behavior) sets delete_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). Today s3_replication_enabled = true on 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 validate passes. No behavior change with the new inputs unset.
  • A follow-up PR to cloudposse-terraform-components/aws-tfstate-backend will expose these inputs.

Don't miss a new terraform-aws-tfstate-backend release

NewReleases is sending notifications on new releases.