Skip to content

Commit

Permalink
updated cloudfront to use Managed cache optimized policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Cullan Carey authored and Cullan Carey committed May 11, 2022
1 parent 460ddd6 commit 6e538e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Local .terraform directories
**/.terraform/*
*.terraform*

# .tfstate files
*.tfstate
Expand Down
23 changes: 8 additions & 15 deletions cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,8 @@ resource "aws_cloudfront_distribution" "website_distribution" {
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "HA-website"
min_ttl = 0
default_ttl = 0
max_ttl = 0
cache_policy_id = data.aws_cloudfront_cache_policy.cache_policy.id
smooth_streaming = false
forwarded_values {
headers = []
query_string = false
query_string_cache_keys = []

cookies {
forward = "none"
whitelisted_names = []
}
}
}

restrictions {
geo_restriction {
Expand All @@ -98,4 +85,10 @@ resource "aws_cloudfront_distribution" "website_distribution" {
cloudfront_default_certificate = false
minimum_protocol_version = "TLSv1.2_2021"
}
}
}


data "aws_cloudfront_cache_policy" "cache_policy" {
name = "Managed-CachingOptimized"
}

0 comments on commit 6e538e6

Please sign in to comment.