Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not create ACL resource if Bucket Owner Enforced #300

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ locals {
website_password_enabled = local.website_enabled && var.s3_website_password_enabled
s3_origin_enabled = local.enabled && !var.website_enabled
create_s3_origin_bucket = local.enabled && var.origin_bucket == null
create_s3_acl = local.create_s3_origin_bucket && var.s3_object_ownership != "BucketOwnerEnforced"
s3_access_logging_enabled = local.enabled && (var.s3_access_logging_enabled == null ? length(var.s3_access_log_bucket_name) > 0 : var.s3_access_logging_enabled)
create_cf_log_bucket = local.cloudfront_access_logging_enabled && local.cloudfront_access_log_create_bucket

Expand Down Expand Up @@ -318,7 +319,7 @@ resource "aws_s3_bucket_cors_configuration" "origin" {

resource "aws_s3_bucket_acl" "origin" {
depends_on = [aws_s3_bucket_ownership_controls.origin]
count = local.create_s3_origin_bucket ? 1 : 0
count = local.create_s3_acl ? 1 : 0

bucket = one(aws_s3_bucket.origin).id
acl = "private"
Expand Down