From 2b0916dc3eef1809d368dd6924319b29553c1bfb Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 08:29:38 -0400 Subject: [PATCH 01/13] remove create_... in variables.tf --- variables.tf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/variables.tf b/variables.tf index b5f9a36..f13e48c 100644 --- a/variables.tf +++ b/variables.tf @@ -1,9 +1,3 @@ -variable "create_vpn_connection" { - description = "Controls whether to create the VPN resources" - type = bool - default = true -} - variable "name" { description = "Name tag to associate to all resources that support tags" type = string From 968c6d539e7a3712e27e350dc46ab625164c9e83 Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 08:30:39 -0400 Subject: [PATCH 02/13] removed non-aliased provider in main.tf --- main.tf | 3 --- 1 file changed, 3 deletions(-) diff --git a/main.tf b/main.tf index 18c5a1b..b34aa4e 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,3 @@ -provider "aws" { -} - locals { vgw_name = var.name == null ? "VGW" : "VGW_${var.name}" cgw_name = var.name == null ? "CGW" : "CGW_${var.name}" From 0bb52b0584d005e5e2a151d772ada28526dce789 Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 08:33:40 -0400 Subject: [PATCH 03/13] removed any references to the create_... in main.tf --- main.tf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main.tf b/main.tf index b34aa4e..b079dc2 100644 --- a/main.tf +++ b/main.tf @@ -5,7 +5,6 @@ locals { } resource "aws_vpn_gateway" "this" { - count = var.create_vpn_connection ? 1 : 0 vpc_id = var.vpc_id amazon_side_asn = var.amazon_side_asn @@ -18,7 +17,6 @@ resource "aws_vpn_gateway" "this" { } resource "aws_customer_gateway" "this" { - count = var.create_vpn_connection ? length(var.cgw_ip_addresses) : 0 bgp_asn = var.cgw_bgp_asn ip_address = var.cgw_ip_addresses[count.index] @@ -32,7 +30,6 @@ resource "aws_customer_gateway" "this" { } resource "aws_vpn_connection" "this" { - count = var.create_vpn_connection ? length(var.cgw_ip_addresses) : 0 vpn_gateway_id = aws_vpn_gateway.this[0].id customer_gateway_id = aws_customer_gateway.this[count.index].id @@ -47,14 +44,12 @@ resource "aws_vpn_connection" "this" { } resource "aws_vpn_connection_route" "this" { - count = var.create_vpn_connection ? length(var.destination_cidr_blocks) : 0 destination_cidr_block = var.destination_cidr_blocks[count.index] vpn_connection_id = aws_vpn_connection.this[0].id } resource "aws_vpn_gateway_route_propagation" "this" { - count = var.create_vpn_connection ? var.propagating_route_table_count : 0 vpn_gateway_id = aws_vpn_gateway.this[0].id route_table_id = var.propagating_route_table_ids[count.index] From b895b556a18c51f4ac927ed6a641074059b38753 Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 08:38:20 -0400 Subject: [PATCH 04/13] removed the join() action in outputs.tf --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index dc17d4f..c9c57a2 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,6 +1,6 @@ output "vpn_gateway_id" { description = "ID of the VPN Gateway" - value = join("", aws_vpn_gateway.this.*.id) + value = aws_vpn_gateway.this.*.id } output "customer_gateway_ids" { From 29121548671770a7d026a4595878bb4a0f94275e Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 08:39:11 -0400 Subject: [PATCH 05/13] removed tests/no_create directory --- tests/no_create/README.md | 23 ----------------------- tests/no_create/main.tf | 13 ------------- tests/no_create/versions.tf | 3 --- 3 files changed, 39 deletions(-) delete mode 100644 tests/no_create/README.md delete mode 100644 tests/no_create/main.tf delete mode 100644 tests/no_create/versions.tf diff --git a/tests/no_create/README.md b/tests/no_create/README.md deleted file mode 100644 index 5119fd8..0000000 --- a/tests/no_create/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Don't Create Resources Test - - - -## Requirements - -| Name | Version | -|------|---------| -| terraform | >= 0.12 | - -## Providers - -No provider. - -## Inputs - -No input. - -## Outputs - -No output. - - diff --git a/tests/no_create/main.tf b/tests/no_create/main.tf deleted file mode 100644 index f387721..0000000 --- a/tests/no_create/main.tf +++ /dev/null @@ -1,13 +0,0 @@ -provider aws { - region = "us-east-1" -} - - -module "example" { - source = "../../" - providers = { - aws = aws - } - - create_vpn_connection = false -} diff --git a/tests/no_create/versions.tf b/tests/no_create/versions.tf deleted file mode 100644 index d9b6f79..0000000 --- a/tests/no_create/versions.tf +++ /dev/null @@ -1,3 +0,0 @@ -terraform { - required_version = ">= 0.12" -} From 6f3784517f0a0dd9a622e533e2e51802b04d5b28 Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 08:44:57 -0400 Subject: [PATCH 06/13] removed any README.md or versions.tf files from the tests/ directories --- tests/create_customer_gateway/README.md | 25 ----------------------- tests/create_customer_gateway/versions.tf | 3 --- tests/create_vpn_gateway/README.md | 25 ----------------------- tests/create_vpn_gateway/versions.tf | 3 --- 4 files changed, 56 deletions(-) delete mode 100644 tests/create_customer_gateway/README.md delete mode 100644 tests/create_customer_gateway/versions.tf delete mode 100644 tests/create_vpn_gateway/README.md delete mode 100644 tests/create_vpn_gateway/versions.tf diff --git a/tests/create_customer_gateway/README.md b/tests/create_customer_gateway/README.md deleted file mode 100644 index 2b62996..0000000 --- a/tests/create_customer_gateway/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Create Customer Gateway Test - - - -## Requirements - -| Name | Version | -|------|---------| -| terraform | >= 0.12 | - -## Providers - -| Name | Version | -|------|---------| -| random | n/a | - -## Inputs - -No input. - -## Outputs - -No output. - - diff --git a/tests/create_customer_gateway/versions.tf b/tests/create_customer_gateway/versions.tf deleted file mode 100644 index d9b6f79..0000000 --- a/tests/create_customer_gateway/versions.tf +++ /dev/null @@ -1,3 +0,0 @@ -terraform { - required_version = ">= 0.12" -} diff --git a/tests/create_vpn_gateway/README.md b/tests/create_vpn_gateway/README.md deleted file mode 100644 index 0e4dc4b..0000000 --- a/tests/create_vpn_gateway/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Create VPN Gateway Test - - - -## Requirements - -| Name | Version | -|------|---------| -| terraform | >= 0.12 | - -## Providers - -| Name | Version | -|------|---------| -| random | n/a | - -## Inputs - -No input. - -## Outputs - -No output. - - diff --git a/tests/create_vpn_gateway/versions.tf b/tests/create_vpn_gateway/versions.tf deleted file mode 100644 index d9b6f79..0000000 --- a/tests/create_vpn_gateway/versions.tf +++ /dev/null @@ -1,3 +0,0 @@ -terraform { - required_version = ">= 0.12" -} From 6e5d8c9762792d08883b54508a0661bd2d6a65eb Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 09:26:27 -0400 Subject: [PATCH 07/13] updated remaining tests/ to remove references to the create_ variable --- tests/create_customer_gateway/main.tf | 1 - tests/create_vpn_gateway/main.tf | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/create_customer_gateway/main.tf b/tests/create_customer_gateway/main.tf index 32a168c..c7f9bc2 100644 --- a/tests/create_customer_gateway/main.tf +++ b/tests/create_customer_gateway/main.tf @@ -26,7 +26,6 @@ module "example" { aws = aws } - create_vpn_connection = true name = "tardigrade-vpc-connection-${random_string.this.result}" vpc_id = module.vpc.vpc_id cgw_ip_addresses = ["19.1.1.1", "19.1.1.2"] diff --git a/tests/create_vpn_gateway/main.tf b/tests/create_vpn_gateway/main.tf index 9bf54d8..f8cd0df 100644 --- a/tests/create_vpn_gateway/main.tf +++ b/tests/create_vpn_gateway/main.tf @@ -26,7 +26,6 @@ module "example" { aws = aws } - create_vpn_connection = true name = "tardigrade-vpn-connection-${random_string.this.result}" vpc_id = module.vpc.vpc_id } From 622e0108a1da68068dc61a0a0381c9a58bf7a838 Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 09:47:56 -0400 Subject: [PATCH 08/13] removed wildcard based on PR --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index c9c57a2..dd60b9e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,6 +1,6 @@ output "vpn_gateway_id" { description = "ID of the VPN Gateway" - value = aws_vpn_gateway.this.*.id + value = aws_vpn_gateway.this.id } output "customer_gateway_ids" { From 8ce7c651f87374861ec8df95e510fe2e69ecd356 Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 10:31:35 -0400 Subject: [PATCH 09/13] Adjusted indexing on aws_vpn_gateway based on PR --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index b079dc2..4ee522b 100644 --- a/main.tf +++ b/main.tf @@ -31,7 +31,7 @@ resource "aws_customer_gateway" "this" { resource "aws_vpn_connection" "this" { - vpn_gateway_id = aws_vpn_gateway.this[0].id + vpn_gateway_id = aws_vpn_gateway.this.id customer_gateway_id = aws_customer_gateway.this[count.index].id type = "ipsec.1" static_routes_only = var.static_routes_only @@ -51,6 +51,6 @@ resource "aws_vpn_connection_route" "this" { resource "aws_vpn_gateway_route_propagation" "this" { - vpn_gateway_id = aws_vpn_gateway.this[0].id + vpn_gateway_id = aws_vpn_gateway.this.id route_table_id = var.propagating_route_table_ids[count.index] } From 82b5348bffa39291acbc562314bc9b98803c3fb0 Mon Sep 17 00:00:00 2001 From: Cody Massey Date: Tue, 27 Oct 2020 11:06:15 -0400 Subject: [PATCH 10/13] Removed conditional on count values based on PR --- main.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.tf b/main.tf index 4ee522b..426b336 100644 --- a/main.tf +++ b/main.tf @@ -17,6 +17,7 @@ resource "aws_vpn_gateway" "this" { } resource "aws_customer_gateway" "this" { + count = length(var.cgw_ip_addresses) bgp_asn = var.cgw_bgp_asn ip_address = var.cgw_ip_addresses[count.index] @@ -30,6 +31,7 @@ resource "aws_customer_gateway" "this" { } resource "aws_vpn_connection" "this" { + count = length(var.cgw_ip_addresses) vpn_gateway_id = aws_vpn_gateway.this.id customer_gateway_id = aws_customer_gateway.this[count.index].id @@ -44,12 +46,14 @@ resource "aws_vpn_connection" "this" { } resource "aws_vpn_connection_route" "this" { + count = length(var.destination_cidr_blocks) destination_cidr_block = var.destination_cidr_blocks[count.index] vpn_connection_id = aws_vpn_connection.this[0].id } resource "aws_vpn_gateway_route_propagation" "this" { + count = var.propagating_route_table_count vpn_gateway_id = aws_vpn_gateway.this.id route_table_id = var.propagating_route_table_ids[count.index] From a7f0f95e8f5e4033e7d3d68ebda6bb7e4d4e85aa Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Fri, 30 Oct 2020 07:28:27 -0700 Subject: [PATCH 11/13] Formats terraform files --- tests/create_customer_gateway/main.tf | 8 ++++---- tests/create_vpn_gateway/main.tf | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/create_customer_gateway/main.tf b/tests/create_customer_gateway/main.tf index c7f9bc2..2845c36 100644 --- a/tests/create_customer_gateway/main.tf +++ b/tests/create_customer_gateway/main.tf @@ -26,8 +26,8 @@ module "example" { aws = aws } - name = "tardigrade-vpc-connection-${random_string.this.result}" - vpc_id = module.vpc.vpc_id - cgw_ip_addresses = ["19.1.1.1", "19.1.1.2"] - cgw_bgp_asn = "64511" + name = "tardigrade-vpc-connection-${random_string.this.result}" + vpc_id = module.vpc.vpc_id + cgw_ip_addresses = ["19.1.1.1", "19.1.1.2"] + cgw_bgp_asn = "64511" } diff --git a/tests/create_vpn_gateway/main.tf b/tests/create_vpn_gateway/main.tf index f8cd0df..a9671df 100644 --- a/tests/create_vpn_gateway/main.tf +++ b/tests/create_vpn_gateway/main.tf @@ -26,6 +26,6 @@ module "example" { aws = aws } - name = "tardigrade-vpn-connection-${random_string.this.result}" - vpc_id = module.vpc.vpc_id + name = "tardigrade-vpn-connection-${random_string.this.result}" + vpc_id = module.vpc.vpc_id } From 4f3c435571b1a6c24da1b06ee978febd83d85c75 Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Fri, 30 Oct 2020 07:40:57 -0700 Subject: [PATCH 12/13] Generates readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b93d702..3fcacf5 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ Terraform module to create a VPN Connection | amazon\_side\_asn | ASN for the Amazon side of the VPN gateway | `string` | `"64512"` | no | | cgw\_bgp\_asn | BGP ASN of the customer gateway | `string` | `null` | no | | cgw\_ip\_addresses | List of IP addresses of the customer gateways | `list(string)` | `[]` | no | -| create\_vpn\_connection | Controls whether to create the VPN resources | `bool` | `true` | no | | destination\_cidr\_blocks | List of CIDR blocks to route through the VPN Connection | `list` | `[]` | no | | name | Name tag to associate to all resources that support tags | `string` | `null` | no | | propagating\_route\_table\_count | Number of route tables in the list of progagating\_route\_table\_ids | `string` | `"0"` | no | From 8bd38f7dfa01c8f61234e3eec8e805b2603702c2 Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Fri, 30 Oct 2020 07:49:05 -0700 Subject: [PATCH 13/13] Bumps version to 2.0.0 --- .bumpversion.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e318d2f..b49e513 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,7 +1,6 @@ [bumpversion] -current_version = 1.0.2 +current_version = 2.0.0 commit = True message = Bumps version to {new_version} tag = False tag_name = {new_version} -