From d9af1d7ba8b544c4177344c65d230c4de775fff6 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 12 Oct 2017 10:56:02 -0700 Subject: [PATCH] Add support for `custom_error_response` (#6) --- README.md | 1 + main.tf | 2 ++ variables.tf | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/README.md b/README.md index cfb99d5..f92204e 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ aws acm request-certificate --domain-name example.com --subject-alternative-name | `tags` | `{}` | Additional tags (e.g. `map("BusinessUnit","XYZ")` | No | | `acm_certificate_arn` | `` | Existing ACM Certificate ARN | No | | `aliases` | `[]` | List of aliases. CAUTION! Names MUSTN'T contain trailing `.` | Yes | +| `custom_error_response` | `[]` | List of one or more custom error response element maps | No | | `allowed_methods` | `["*"]` | List of allowed methods (e.g. ` GET, PUT, POST, DELETE, HEAD`) for AWS CloudFront | No | | `cached_methods` | `["GET", "HEAD"]` | List of cached methods (e.g. ` GET, PUT, POST, DELETE, HEAD`) | No | | `comment` | `Managed by Terraform` | Comment for the origin access identity | No | diff --git a/main.tf b/main.tf index b43f979..ea08d0c 100644 --- a/main.tf +++ b/main.tf @@ -51,6 +51,8 @@ resource "aws_cloudfront_distribution" "default" { aliases = ["${var.aliases}"] + custom_error_response = ["${var.custom_error_response}"] + origin { domain_name = "${var.origin_domain_name}" origin_id = "${module.distribution_label.id}" diff --git a/variables.tf b/variables.tf index e5dad45..dfb7cfb 100644 --- a/variables.tf +++ b/variables.tf @@ -31,6 +31,15 @@ variable "aliases" { default = [] } +variable "custom_error_response" { + # http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html#custom-error-pages-procedure + # https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#custom-error-response-arguments + description = "(Optional) - List of one or more custom error response element maps" + + type = "list" + default = [] +} + variable "origin_domain_name" { description = "(Required) - The DNS domain name of your custom origin (e.g. website)" default = ""