Skip to content

Commit

Permalink
Merge pull request #2 from orangesys/fixbug
Browse files Browse the repository at this point in the history
Fixbug
  • Loading branch information
daisuki-konbini authored Dec 1, 2020
2 parents 52c87c0 + dd112d0 commit 3a6b384
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
compress = false
viewer_protocol_policy = "redirect-to-https"

lambda_function_association {
count = var.lambda_arn != "" ? 1 : 0
event_type = "viewer-request"
lambda_arn = var.lambda_arn
include_body = false
dynamic "lambda_function_association" {
for_each = var.lambda_arn != "" ? [var.lambda_arn] : []
content {
event_type = "viewer-request"
lambda_arn = lambda_function_association.value
include_body = false
}

}
}

Expand Down
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ variable "tags" {
variable "lambda_arn" {
description = "ARN of the Lambda function"
type = string
default = ""
}

variable "acm_certificate_arn" {
Expand Down

0 comments on commit 3a6b384

Please sign in to comment.