Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions aws/cloudfront/-input.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ variable "response_headers_policy_id" {
type = string
}

variable "default_lambda_function_associations" {
default = []
type = list(object({
event_type = string
lambda_arn = string
include_body = optional(bool)
}))
}

variable "tags" {
default = {}
type = map(string)
Expand Down
8 changes: 8 additions & 0 deletions aws/cloudfront/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ resource "aws_cloudfront_distribution" "distribution" {
event_type = "origin-request"
lambda_arn = aws_lambda_function.redirector.qualified_arn
}
dynamic "lambda_function_association" {
for_each = var.default_lambda_function_associations
content {
event_type = lambda_function_association.value.event_type
include_body = lookup(lambda_function_association.value, "include_body", null)
lambda_arn = lambda_function_association.value.lambda_arn
}
}
max_ttl = 86400
min_ttl = 0
response_headers_policy_id = var.response_headers_policy_id
Expand Down