Skip to content

Commit

Permalink
update acl private handling on s3 buckets with new acl resources
Browse files Browse the repository at this point in the history
  • Loading branch information
avrohomgottlieb committed Nov 22, 2024
1 parent 449a9fd commit da0ae95
Showing 1 changed file with 23 additions and 30 deletions.
53 changes: 23 additions & 30 deletions infrastructure/s3.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
resource "aws_s3_bucket" "scpca_portal_bucket" {
bucket = "scpca-portal-${var.user}-${var.stage}"
# TODO: remove this when upgrading aws_provider version
acl = "private"
force_destroy = var.stage == "prod" ? false : true

tags = merge(
Expand All @@ -13,21 +11,19 @@ resource "aws_s3_bucket" "scpca_portal_bucket" {
)
}

# TODO: enable after upgrade
# resource "aws_s3_bucket_ownership_controls" "scpca_portal_bucket" {
# bucket = aws_s3_bucket.scpca_portal_bucket.id
# rule {
# object_ownership = "BucketOwnerPreferred"
# }
#}
resource "aws_s3_bucket_ownership_controls" "scpca_portal_bucket" {
bucket = aws_s3_bucket.scpca_portal_bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}

# TODO: enable after upgrade
# resource "aws_s3_bucket_acl" "scpca_portal_bucket" {
# depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_bucket]
#
# bucket = aws_s3_bucket.scpca_portal_bucket.id
# acl = "private"
#}
resource "aws_s3_bucket_acl" "scpca_portal_bucket" {
depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_bucket]

bucket = aws_s3_bucket.scpca_portal_bucket.id
acl = "private"
}

resource "aws_s3_bucket_public_access_block" "scpca_portal_bucket" {
bucket = aws_s3_bucket.scpca_portal_bucket.id
Expand All @@ -38,8 +34,6 @@ resource "aws_s3_bucket_public_access_block" "scpca_portal_bucket" {

resource "aws_s3_bucket" "scpca_portal_cert_bucket" {
bucket = "scpca-portal-cert-${var.user}-${var.stage}"
# TODO: remove this when upgrading aws_provider version
acl = "private"
force_destroy = var.stage == "prod" ? false : true

# TODO: remove lifecycle rule when we upgrade aws_provider version
Expand All @@ -63,19 +57,18 @@ resource "aws_s3_bucket" "scpca_portal_cert_bucket" {
)
}

# TODO: enable after upgrade
# resource "aws_s3_bucket_ownership_controls" "scpca_portal_cert_bucket" {
# bucket = aws_s3_bucket.scpca_portal_cert_bucket.id
# rule {
# object_ownership = "BucketOwnerPreferred"
# }
#}
resource "aws_s3_bucket_ownership_controls" "scpca_portal_cert_bucket" {
bucket = aws_s3_bucket.scpca_portal_cert_bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}

# resource "aws_s3_bucket_acl" "scpca_portal_cert_bucket" {
# depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_cert_bucket]
# bucket = aws_s3_bucket.scpca_portal_cert_bucket.id
# acl = "private"
#}
resource "aws_s3_bucket_acl" "scpca_portal_cert_bucket" {
depends_on = [aws_s3_bucket_ownership_controls.scpca_portal_cert_bucket]
bucket = aws_s3_bucket.scpca_portal_cert_bucket.id
acl = "private"
}

# resource "aws_s3_bucket_lifecycle_configuration" "scpca_portal_cert_bucket" {
# bucket = aws_s3_bucket.scpca_portal_cert_bucket.id
Expand Down

0 comments on commit da0ae95

Please sign in to comment.