Use newer S3 configuration resources
This commit is contained in:
parent
094091dd21
commit
9f13ace88c
1 changed files with 29 additions and 7 deletions
|
@ -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" {
|
||||||
|
|
Loading…
Reference in a new issue