From 68db87b0be3aa90bb13965c17c7caa5ca7f14970 Mon Sep 17 00:00:00 2001 From: Sion Smith Date: Thu, 25 Feb 2021 07:23:21 +0000 Subject: [PATCH] added compression flag --- aws_cloudfront_distribution.tf | 2 ++ variables.tf | 6 ++++++ 2 files changed, 8 insertions(+) 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."