Skip to content

Commit 735c40e

Browse files
Merge pull request #6 from TechHoldingLLC/update-config
Update cache config
2 parents f782e37 + eee5195 commit 735c40e

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

cloudfront.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ resource "aws_cloudfront_distribution" "cloudfront" {
44
web_acl_id = var.web_acl_id #tfsec:ignore:aws-cloudfront-enable-waf
55
comment = var.comment
66
http_version = var.http_version
7-
is_ipv6_enabled = var.ipv6
7+
is_ipv6_enabled = var.is_ipv6_enabled
88

99
dynamic "origin" {
1010
for_each = [var.origin]
1111

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: 7 additions & 1 deletion
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
@@ -92,7 +98,7 @@ variable "http_version" {
9298
default = "http2"
9399
}
94100

95-
variable "ipv6" {
101+
variable "is_ipv6_enabled" {
96102
description = "ipv6 status"
97103
type = bool
98104
default = false

0 commit comments

Comments
 (0)