Skip to content

Commit 68a14a4

Browse files
authored
Allow lambda_function_associations to be set for ordered cache behaviors (#81)
1 parent 95dddd3 commit 68a14a4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,11 @@ variable "cloudfront_ordered_cache_behaviors" {
228228
default_ttl = optional(number)
229229
field_level_encryption_id = optional(string)
230230
# forwarded_values will not be supported as Hashicorp had already deprecated it at the time of implementing this module
231-
# TODO support lambda_function_association and function_association
231+
function_association = optional(list(object({
232+
event_type = string
233+
function_arn = string
234+
})), [])
235+
# TODO support lambda_function_association
232236
max_ttl = optional(number)
233237
min_ttl = optional(number)
234238
origin_request_policy_id = string

website.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ resource "aws_cloudfront_distribution" "website" {
216216
smooth_streaming = ordered_cache_behavior.value.smooth_streaming
217217
target_origin_id = ordered_cache_behavior.value.target_origin_id
218218
viewer_protocol_policy = ordered_cache_behavior.value.viewer_protocol_policy
219+
dynamic "function_association" {
220+
for_each = ordered_cache_behavior.value.function_association
221+
content {
222+
event_type = function_association.value.event_type
223+
function_arn = function_association.value.function_arn
224+
}
225+
}
219226
}
220227
}
221228

0 commit comments

Comments
 (0)