15
votes

I want to create a S3 and make it encryption at rest with AES256, but terraform complain that: * aws_s3_bucket.s3: : invalid or unknown key: server_side_encryption_configuration (see my code complained by terraform below)

What is wrong with server_side_encryption_configuration? isn't it supported? https://www.terraform.io/docs/providers/aws/r/s3_bucket.html

Anyway, how to have "encryption at rest with AES256" for S3 using terraform?

resource "aws_s3_bucket" "s3" {
  bucket = "s3_bucket_name"
  acl = "private"
  force_destroy = true
  server_side_encryption_configuration {
    rule {
      apply_server_side_encryption_by_default {
        sse_algorithm     = "AES256"
      }
    }
 }
}
1

1 Answers

9
votes

You probably have an older version of the AWS provider plugin. To update it, run terraform init with the -upgrade flag set to true

terraform init -upgrade=true