Skip to content

Commit 9577f35

Browse files
committed
update cloudfront config default value
1 parent f782e37 commit 9577f35

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

cloudfront.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ resource "aws_cloudfront_distribution" "cloudfront" {
1212
content {
1313
domain_name = origin.value.domain_name
1414
origin_id = origin.value.origin_id
15+
origin_path = lookup(origin.value, "origin_path", "")
1516

1617
dynamic "s3_origin_config" {
1718
for_each = length(keys(lookup(origin.value, "s3_origin_config", {}))) > 0 ? [lookup(origin.value, "s3_origin_config")] : []
@@ -28,7 +29,7 @@ resource "aws_cloudfront_distribution" "cloudfront" {
2829
origin_protocol_policy = custom_origin_config.value.origin_protocol_policy
2930
http_port = lookup(custom_origin_config.value, "http_port", 80)
3031
https_port = lookup(custom_origin_config.value, "https_port", 443)
31-
origin_ssl_protocols = lookup(custom_origin_config.value, "origin_ssl_protocols", ["TLSv1", "TLSv1.1", "TLSv1.2"])
32+
origin_ssl_protocols = lookup(custom_origin_config.value, "origin_ssl_protocols", ["TLSv1.2"])
3233
}
3334
}
3435

@@ -60,10 +61,10 @@ resource "aws_cloudfront_distribution" "cloudfront" {
6061
origin_request_policy_id = var.origin_request_policy_id
6162

6263
viewer_protocol_policy = var.viewer_protocol_policy
63-
compress = true
64-
min_ttl = lookup(var.ttl_values, "min_ttl", 0)
65-
max_ttl = lookup(var.ttl_values, "max_ttl", 86400)
66-
default_ttl = lookup(var.ttl_values, "default_ttl", 3600)
64+
compress = var.compress
65+
min_ttl = lookup(var.ttl_values, "min_ttl", null)
66+
max_ttl = lookup(var.ttl_values, "max_ttl", null)
67+
default_ttl = lookup(var.ttl_values, "default_ttl", null)
6768

6869
dynamic "forwarded_values" {
6970
for_each = var.cache_policy_id != "" ? [] : [1]

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ variable "custom_error_response" {
2222
default = []
2323
}
2424

25+
variable "compress" {
26+
description = "Compress file"
27+
type = bool
28+
default = false
29+
}
30+
2531
variable "default_root_object" {
2632
description = "Default root object"
2733
type = string

0 commit comments

Comments
 (0)