Skip to content

fix: skip log bucket replication when archive bucket not configured#257

Open
matthewhanson wants to merge 4 commits intoElement84:mainfrom
matthewhanson:fix/log-archive-replication-guard
Open

fix: skip log bucket replication when archive bucket not configured#257
matthewhanson wants to merge 4 commits intoElement84:mainfrom
matthewhanson:fix/log-archive-replication-guard

Conversation

@matthewhanson
Copy link
Copy Markdown

Summary

Guards the aws_s3_bucket_replication_configuration resource in both
CloudFront logging modules so it is only created when an archive bucket
is actually provided.

Changes

  • modules/cloudfront/s3_origin/logging.tf: add && var.filmdrop_archive_bucket_name != "" to replication resource count
  • modules/cloudfront/custom_origin/logging.tf: same fix

Before

count = var.create_log_bucket ? 1 : 0

After

 count = var.create_log_bucket && var.filmdrop_archive_bucket_name != "" ? 1 : 0

Testing

terragrunt plan now succeeds with deploy_log_archive = false. The log bucket is still created; replication is skipped when no
archive destination is configured.

Fixes #256

Matthew Hanson and others added 4 commits April 22, 2026 15:28
When deploy_log_archive = false, filmdrop_archive_bucket_name is
passed as an empty string. The replication configuration would then
build an invalid ARN (arn:aws:s3:::) causing plan failures.

Guard the replication resource so it is only created when both
create_log_bucket is true AND a non-empty archive bucket is provided.
Applies to both s3_origin and custom_origin CloudFront modules.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rovisioners

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CloudFront log bucket replication fails when archive bucket is not configured

2 participants