Interview Prep/Terraform/State and Backends in Production

What does a hardened S3 state bucket look like?

IntermediateProductionState and Backends in Production
Answer

Versioning on, default SSE-KMS encryption, all four public-access-block settings enabled, a bucket policy that denies non-TLS requests and restricts principals to the CI roles, access logging, lifecycle rules to expire noncurrent versions after N days, and optionally cross-region replication.

resource "aws_s3_bucket_versioning" "state" {
  bucket = aws_s3_bucket.state.id
  versioning_configuration { status = "Enabled" }
}
All Terraform questions Roadmap: Terraform in production

More on State and Backends in Production