Skip to content

Commit

Permalink
Upgrade AWS provider to a new major release
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba committed Apr 6, 2022
1 parent 3bab6fe commit 4251f44
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 27 deletions.
27 changes: 14 additions & 13 deletions examples/basic/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 33 additions & 14 deletions modules/storage/main.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
resource "aws_s3_bucket" "storage" {
bucket = var.bucket_name
acl = "private"
policy = data.aws_iam_policy_document.storage_bucket.json
}

// Encrypt with an Amazon-managed key
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
resource "aws_s3_bucket_acl" "storage" {
bucket = aws_s3_bucket.storage.id
acl = "private"
}

lifecycle_rule {
enabled = true
abort_incomplete_multipart_upload_days = 7
}
resource "aws_s3_bucket_cors_configuration" "storage" {
bucket = aws_s3_bucket.storage.id

cors_rule {
allowed_headers = ["*"]
Expand Down Expand Up @@ -61,6 +54,32 @@ resource "aws_s3_bucket" "storage" {
}
}

resource "aws_s3_bucket_lifecycle_configuration" "storage" {
bucket = aws_s3_bucket.storage.id

rule {
status = "Enabled"
abort_incomplete_multipart_upload {
days_after_initiation = 7
}
}
}

resource "aws_s3_bucket_server_side_encryption_configuration" "storage" {
bucket = aws_s3_bucket.storage.id

// Encrypt with an Amazon-managed key
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

resource "aws_s3_bucket_policy" "storage" {
bucket = aws_s3_bucket.storage.id
policy = data.aws_iam_policy_document.storage_bucket.json
}

data "aws_iam_policy_document" "storage_bucket" {
statement {
Expand Down
1 change: 1 addition & 0 deletions modules/storage/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.9.0"
}
}
}

0 comments on commit 4251f44

Please sign in to comment.