From b6df830222cd7b65fba6a55f8423a4b964c268f9 Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Tue, 6 Oct 2020 19:43:14 +0200 Subject: [PATCH] Revert "fix: Create only required number of NAT gateways (#492)" This reverts commit 712e1f974173b4b4b9bf894491b11754198dcf1d. --- examples/simple-vpc/main.tf | 13 ++++++------- main.tf | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/simple-vpc/main.tf b/examples/simple-vpc/main.tf index fb16c99a5..99bcb3da2 100644 --- a/examples/simple-vpc/main.tf +++ b/examples/simple-vpc/main.tf @@ -9,15 +9,14 @@ module "vpc" { cidr = "10.0.0.0/16" - azs = ["eu-west-1a", "eu-west-1b", "euw1-az3"] - private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] - database_subnets = ["10.0.5.0/24"] - public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24", "10.0.104.0/24"] + azs = ["eu-west-1a", "eu-west-1b", "euw1-az3"] + private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] + public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] - enable_nat_gateway = true - # single_nat_gateway = true + enable_ipv6 = true - create_database_subnet_group = false + enable_nat_gateway = true + single_nat_gateway = true public_subnet_tags = { Name = "overridden-name-public" diff --git a/main.tf b/main.tf index bd68e7fd8..85ba280d5 100644 --- a/main.tf +++ b/main.tf @@ -5,7 +5,7 @@ locals { length(var.database_subnets), length(var.redshift_subnets), ) - nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length < length(var.public_subnets) ? local.max_subnet_length : length(var.public_subnets) + nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free! vpc_id = element(