Skip to content

Commit baefcd4

Browse files
committed
feat: add support for cloudfront function
1 parent 66f3398 commit baefcd4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ resource "aws_cloudfront_distribution" "website" {
153153
include_body = lambda_function_association.value.include_body
154154
}
155155
}
156+
dynamic "function_association" {
157+
for_each = { for i, l in var.functions : "function-${i}" => l }
158+
content {
159+
event_type = function_association.value.event_type
160+
function_arn = function_association.value.function_arn
161+
}
162+
}
156163
}
157164

158165
dynamic "ordered_cache_behavior" {

variables.tf

+7
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,10 @@ variable "can_overwrite" {
9999
default = false
100100
description = "Allow overwriting route53 records for pre-existing CNAME/certificates"
101101
}
102+
variable "functions" {
103+
type = list(object({
104+
event_type = string
105+
function_arn = string
106+
}))
107+
default = []
108+
}

0 commit comments

Comments
 (0)