Skip to content

Commit

Permalink
Add support do edgelambda on site-redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
pjuniorlima committed Jun 28, 2021
1 parent 7444498 commit 20f4506
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions site-redirect/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ resource "aws_cloudfront_distribution" "website_cdn" {
allowed_methods = ["GET", "HEAD", "DELETE", "OPTIONS", "PATCH", "POST", "PUT"]
cached_methods = ["GET", "HEAD"]

dynamic "lambda_function_association" {
for_each = var.enable_lambda_sec_headers == null ? [] : var.enable_lambda_sec_headers
content {
event_type = lambda_function_association.value.event_type
lambda_arn = lambda_function_association.value.lambda_arn
}
}

forwarded_values {
query_string = var.forward-query-string

Expand Down
10 changes: 10 additions & 0 deletions site-redirect/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,14 @@ variable "forward-query-string" {
type = bool
description = "Forward the query string to the origin"
default = true
}

variable "enable_lambda_sec_headers" {
type = list(object({
event_type = string
lambda_arn = string
}))
default = null

description = "Specifies the lambda function of security headers"
}

0 comments on commit 20f4506

Please sign in to comment.