Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created November 17, 2019 23:03
Show Gist options
  • Select an option

  • Save KyMidd/85dbd05e363d474bdb5ab5ecef09bb6b to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/85dbd05e363d474bdb5ab5ecef09bb6b to your computer and use it in GitHub Desktop.
resource "aws_s3_bucket" "state_bucket" {
bucket = var.name_of_s3_bucket
# Tells AWS to encrypt the S3 bucket at rest by default
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
# Prevents Terraform from destroying or replacing this object - a great safety mechanism
lifecycle {
prevent_destroy = true
}
# Tells AWS to keep a version history of the state file
versioning {
enabled = true
}
tags = {
Terraform = "true"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment