Skip to content

Commit

Permalink
TF: fix redirect ref
Browse files Browse the repository at this point in the history
  • Loading branch information
timmeinerzhagen committed Nov 1, 2021
1 parent 9d0b064 commit f456225
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ locals {
s3_origin_id = "${var.deployment_name}-S3-website"
s3_data_origin_id = "${var.deployment_name}-S3-data"
dummy_origin_id = "${var.deployment_name}-dummy-origin"
use_origin_request = var.redirects != null || var.allow_omit_html_extension == true
}

resource "aws_cloudfront_origin_access_identity" "main" {
Expand Down Expand Up @@ -152,14 +151,10 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
include_body = false
}

dynamic "lambda_function_association" {
for_each = local.use_origin_request ? [
0] : []
content {
event_type = "origin-request"
lambda_arn = module.lambda_edge_function["redirects"].qualified_arn
include_body = false
}
lambda_function_association {
event_type = "origin-request"
lambda_arn = module.lambda_edge_function["rewrite-trailing-slash"].qualified_arn
include_body = false
}
}
}
Expand Down

0 comments on commit f456225

Please sign in to comment.