Skip to content

Commit

Permalink
Check if S3 bucket exist to use cloudfront logging
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Diniz <[email protected]>
  • Loading branch information
arthurbdiniz committed Mar 6, 2020
1 parent 58b4a6b commit 600f7a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions _variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ variable "hostname_create" {
}

variable "cloudfront_logging_bucket" {
type = string
default = null
description = "Bucket to store logs from app"
}

variable "cloudfront_logging_prefix" {
type = string
default = ""
description = "Logging prefix"
}
12 changes: 8 additions & 4 deletions cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ resource "aws_cloudfront_distribution" "default" {
}
}

logging_config {
include_cookies = false
bucket = "${var.cloudfront_logging_bucket}"
prefix = "${var.cloudfront_logging_prefix}"
dynamic "logging_config" {
for_each = "${compact([var.cloudfront_logging_bucket])}"

content {
include_cookies = false
bucket = "${var.cloudfront_logging_bucket}"
prefix = "${var.cloudfront_logging_prefix}"
}
}

default_cache_behavior {
Expand Down

0 comments on commit 600f7a5

Please sign in to comment.