diff --git a/aws_cloudfront_distribution.tf b/aws_cloudfront_distribution.tf index 163fe3c..19fca44 100644 --- a/aws_cloudfront_distribution.tf +++ b/aws_cloudfront_distribution.tf @@ -43,6 +43,8 @@ resource "aws_cloudfront_distribution" "s3_distribution" { min_ttl = var.cloudfront_cache_min_ttl default_ttl = var.cloudfront_cache_default_ttl max_ttl = var.cloudfront_cache_max_ttl + compress = var.cloudfront_cache_compress_content + allowed_methods = [ "GET", "HEAD", diff --git a/variables.tf b/variables.tf index c64a758..dbf0514 100644 --- a/variables.tf +++ b/variables.tf @@ -16,6 +16,12 @@ variable "cloudfront_cache_max_ttl" { default = 300 } +variable "cloudfront_cache_compress_content" { + type = bool + description = "Whether you want CloudFront to automatically compress content for web requests that include Accept-Encoding: gzip in the request header" + default = false +} + variable "distribution_fqdn" { type = string description = "Fully qualified domain bound to Cloudfront."