Skip to content

Commit 945d1ea

Browse files
committed
Fixup function association logic
1 parent 1a392f4 commit 945d1ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ resource "aws_cloudfront_distribution" "this" {
375375

376376
content {
377377
event_type = f.key
378-
function_arn = try(f.value.function_arn, aws_cloudfront_function.this[f.value.function_name].arn, null)
378+
function_arn = lookup(f.value, "function_arn", try(aws_cloudfront_function.this[lookup(f.value, "function_name", "")].arn, null))
379379
}
380380
}
381381

@@ -447,7 +447,7 @@ resource "aws_cloudfront_distribution" "this" {
447447

448448
content {
449449
event_type = f.key
450-
function_arn = try(f.value.function_arn, aws_cloudfront_function.this[f.value.function_name].arn, null)
450+
function_arn = lookup(f.value, "function_arn", try(aws_cloudfront_function.this[lookup(f.value, "function_name", "")].arn, null))
451451
}
452452
}
453453

0 commit comments

Comments
 (0)