Skip to content

Commit 65908e9

Browse files
committed
CCM-9874: use managed cache policy
1 parent ef0979c commit 65908e9

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

infrastructure/terraform/components/app/cloudfront_distribution_main.tf

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ resource "aws_cloudfront_distribution" "main" {
6262
viewer_protocol_policy = "redirect-to-https"
6363
compress = true
6464

65-
cache_policy_id = aws_cloudfront_cache_policy.no_cache.id
65+
cache_policy_id = data.aws_cloudfront_cache_policy.caching_disabled.id
6666
origin_request_policy_id = aws_cloudfront_origin_request_policy.forward_cookies.id
6767

6868

@@ -73,18 +73,8 @@ resource "aws_cloudfront_distribution" "main" {
7373
}
7474
}
7575

76-
resource "aws_cloudfront_cache_policy" "no_cache" {
77-
name = "${local.csi}-no-cache-policy"
78-
79-
default_ttl = 0
80-
max_ttl = 0
81-
min_ttl = 0
82-
83-
parameters_in_cache_key_and_forwarded_to_origin {
84-
cookies_config { cookie_behavior = "none" }
85-
headers_config { header_behavior = "none" }
86-
query_strings_config { query_string_behavior = "none" }
87-
}
76+
data "aws_cloudfront_cache_policy" "caching_disabled" {
77+
name = "Managed-CachingDisabled"
8878
}
8979

9080
resource "aws_cloudfront_origin_request_policy" "forward_cookies" {

0 commit comments

Comments
 (0)