From a693549616715dab93c24aac4ff9df2d86bc2cce Mon Sep 17 00:00:00 2001 From: Rajinder Singh Date: Mon, 30 Jul 2018 15:39:48 -0500 Subject: [PATCH] Added ability to disable DNS record creation for aliases (#17) * Added web_acl_id and dns_aliases_enabled * Added web_acl_id * removed dns_aliases_enabled * added web_acl_id * terraform fmt changes * added dns_aliases_enabled --- .gitignore | 7 +++---- README.md | 1 + docs/terraform.md | 1 + main.tf | 3 ++- variables.tf | 5 +++++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 566a6d5..338e4ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,11 @@ # Compiled files *.tfstate *.tfstate.backup -*.terraform.tfstate* # Module directory -.terraform/ +.terraform .idea *.iml -.build-harness -build-harness +**/.build-harness +**/build-harness diff --git a/README.md b/README.md index a1f0a88..7fbd7f9 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ Available targets: | default_root_object | Object that CloudFront return when requests the root URL | string | `index.html` | no | | default_ttl | Default amount of time (in seconds) that an object is in a CloudFront cache | string | `60` | no | | delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | +| dns_aliases_enabled | Set to false to prevent dns records for aliases from being created | string | `true` | no | | enabled | Set to false to prevent the module from creating any resources | string | `true` | no | | forward_cookies | Specifies whether you want CloudFront to forward cookies to the origin. Valid options are all, none or whitelist | string | `none` | no | | forward_cookies_whitelisted_names | List of forwarded cookie names | list | `` | no | diff --git a/docs/terraform.md b/docs/terraform.md index 8e34995..00f4980 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -15,6 +15,7 @@ | default_root_object | Object that CloudFront return when requests the root URL | string | `index.html` | no | | default_ttl | Default amount of time (in seconds) that an object is in a CloudFront cache | string | `60` | no | | delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | +| dns_aliases_enabled | Set to false to prevent dns records for aliases from being created | string | `true` | no | | enabled | Set to false to prevent the module from creating any resources | string | `true` | no | | forward_cookies | Specifies whether you want CloudFront to forward cookies to the origin. Valid options are all, none or whitelist | string | `none` | no | | forward_cookies_whitelisted_names | List of forwarded cookie names | list | `` | no | diff --git a/main.tf b/main.tf index 6e3384f..9d12380 100644 --- a/main.tf +++ b/main.tf @@ -113,7 +113,8 @@ resource "aws_cloudfront_distribution" "default" { } module "dns" { - source = "git::https://github.com/cloudposse/terraform-aws-route53-alias.git?ref=tags/0.2.4" + source = "git::https://github.com/cloudposse/terraform-aws-route53-alias.git?ref=tags/0.2.5" + enabled = "${var.dns_aliases_enabled}" aliases = "${var.aliases}" parent_zone_id = "${var.parent_zone_id}" parent_zone_name = "${var.parent_zone_name}" diff --git a/variables.tf b/variables.tf index 0850ee3..6231145 100644 --- a/variables.tf +++ b/variables.tf @@ -32,6 +32,11 @@ variable "enabled" { description = "Set to false to prevent the module from creating any resources" } +variable "dns_aliases_enabled" { + default = "true" + description = "Set to false to prevent dns records for aliases from being created" +} + variable "acm_certificate_arn" { description = "Existing ACM Certificate ARN" default = ""