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 {
|
|
||||||
enabled = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycle_rule {
|
resource "aws_s3_bucket_versioning" "tfstate" {
|
||||||
enabled = true
|
bucket = aws_s3_bucket.tfstate.id
|
||||||
|
|
||||||
|
versioning_configuration {
|
||||||
|
status = "Enabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_s3_bucket_server_side_encryption_configuration" "tfstate" {
|
||||||
|
bucket = aws_s3_bucket.tfstate.bucket
|
||||||
|
|
||||||
|
rule {
|
||||||
|
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_version_expiration {
|
||||||
days = 10
|
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