Use newer S3 configuration resources
Some checks failed
/ terraform (push) Successful in 1m14s
/ ansible (push) Failing after 2m3s

This commit is contained in:
Jake Howard 2024-01-07 13:49:35 +00:00
parent 094091dd21
commit 9f13ace88c
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -4,20 +4,42 @@ resource "aws_iam_user" "terraform" {
resource "aws_s3_bucket" "tfstate" { resource "aws_s3_bucket" "tfstate" {
bucket = "0rng-terraform" bucket = "0rng-terraform"
acl = "private" }
versioning { resource "aws_s3_bucket_versioning" "tfstate" {
enabled = true bucket = aws_s3_bucket.tfstate.id
versioning_configuration {
status = "Enabled"
} }
}
lifecycle_rule { resource "aws_s3_bucket_server_side_encryption_configuration" "tfstate" {
enabled = true bucket = aws_s3_bucket.tfstate.bucket
noncurrent_version_expiration { rule {
days = 10 apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
} }
} }
}
resource "aws_s3_bucket_lifecycle_configuration" "tfstate" {
bucket = aws_s3_bucket.tfstate.id
rule {
id = "Delete old non-current versions"
status = "Enabled"
noncurrent_version_expiration {
noncurrent_days = 30
}
}
}
resource "aws_s3_bucket_acl" "tfstate" {
bucket = aws_s3_bucket.tfstate.id
acl = "private"
} }
resource "aws_iam_user_policy" "modify-terraform-user" { resource "aws_iam_user_policy" "modify-terraform-user" {