From 0a66af508aee1641e6175356209eba7257fb0ab0 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Tue, 17 Oct 2017 23:18:01 +0600 Subject: [PATCH] Add Support for `Vary` Headers for CloudFront (#7) --- README.md | 1 + main.tf | 2 ++ variables.tf | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/README.md b/README.md index f92204e..4d7dd9e 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ aws acm request-certificate --domain-name example.com --subject-alternative-name | `default_root_object` | `index.html` | Object that CloudFront return when requests the root URL | No | | `enabled` | `true` | State of CloudFront | No | | `forward_cookies` | `none` | Forward cookies to the origin that is associated with this cache behavior | No | +| `forward_headers` | `[]` | Specify headers that you want CloudFront to vary upon for this cache behavior. Specify `*` to include all headers. | No | | `forward_query_string` | `false` | Forward query strings to the origin that is associated with this cache behavior | No | | `geo_restriction_locations` | `[]` | List of country codes for which CloudFront either to distribute content (whitelist) or not distribute your content (blacklist) | No | | `geo_restriction_type` | `none` | Method that use to restrict distribution of your content by country: `none`, `whitelist`, or `blacklist` | No | diff --git a/main.tf b/main.tf index ea08d0c..d88e634 100644 --- a/main.tf +++ b/main.tf @@ -82,6 +82,8 @@ resource "aws_cloudfront_distribution" "default" { compress = "${var.compress}" forwarded_values { + headers = ["${var.forward_headers}"] + query_string = "${var.forward_query_string}" cookies { diff --git a/variables.tf b/variables.tf index dfb7cfb..f93042c 100644 --- a/variables.tf +++ b/variables.tf @@ -125,6 +125,12 @@ variable "forward_query_string" { default = "false" } +variable "forward_headers" { + description = "Specifies the Headers, if any, that you want CloudFront to vary upon for this cache behavior. Specify `*` to include all headers." + type = "list" + default = [] +} + variable "forward_cookies" { default = "none" }