Skip to content

Commit 66c4c52

Browse files
committed
[PRMP-579] Refactor logging configuration to use dynamic block for conditional logging setup
1 parent b7f3193 commit 66c4c52

File tree

1 file changed

+7
-4
lines changed
  • infrastructure/modules/cloudfront

1 file changed

+7
-4
lines changed

infrastructure/modules/cloudfront/main.tf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,13 @@ resource "aws_cloudfront_distribution" "distribution_with_secondary_bucket" {
9898

9999
}
100100

101-
logging_config {
102-
bucket = var.log_bucket_id
103-
# this might break it as path pattern is in format /pattern/
104-
prefix = var.secondary_bucket_path_pattern
101+
dynamic "logging_config" {
102+
for_each = var.log_bucket_id != "" ? [1] : []
103+
content {
104+
bucket = var.log_bucket_id
105+
# this might break it as path pattern is in format /pattern/
106+
prefix = var.secondary_bucket_path_pattern
107+
}
105108
}
106109

107110
viewer_certificate {

0 commit comments

Comments
 (0)