File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 55 length (var. database_subnets ),
66 length (var. redshift_subnets ),
77 )
8- nat_gateway_count = var. single_nat_gateway ? 1 : var. one_nat_gateway_per_az ? length (var. azs ) : local. max_subnet_length
8+ 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 )
99
1010 # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!
1111 vpc_id = element (
@@ -200,7 +200,7 @@ resource "aws_route" "public_internet_gateway_ipv6" {
200200# There are as many routing tables as the number of NAT gateways
201201# ################
202202resource "aws_route_table" "private" {
203- count = var. create_vpc && local . max_subnet_length > 0 ? local . nat_gateway_count : 0
203+ count = var. create_vpc && length (var . private_subnets ) > 0 ? var . single_nat_gateway ? 1 : length (var . private_subnets ) : 0
204204
205205 vpc_id = local. vpc_id
206206
@@ -956,7 +956,7 @@ resource "aws_nat_gateway" "this" {
956956}
957957
958958resource "aws_route" "private_nat_gateway" {
959- count = var. create_vpc && var. enable_nat_gateway ? local . nat_gateway_count : 0
959+ count = var. create_vpc && var. enable_nat_gateway ? var . single_nat_gateway ? 1 : length (var . private_subnets ) : 0
960960
961961 route_table_id = element (aws_route_table. private . * . id , count. index )
962962 destination_cidr_block = " 0.0.0.0/0"
You can’t perform that action at this time.
0 commit comments