diff --git a/routing/main.tf b/routing/main.tf index 2dc4cd4..3d9eb1d 100644 --- a/routing/main.tf +++ b/routing/main.tf @@ -44,7 +44,7 @@ locals { # route table: public #--- resource "aws_route_table" "public" { - for_each = var.create_public_route_table ? local.availability_zones : {} + for_each = var.create_public_route_table ? local.availability_zones : toset([]) vpc_id = var.vpc_id tags = merge( @@ -64,7 +64,7 @@ resource "aws_route_table_association" "public" { # route table: private #--- resource "aws_route_table" "private" { - for_each = var.create_private_route_table ? local.availability_zones : {} + for_each = var.create_private_route_table ? local.availability_zones : toset([]) vpc_id = var.vpc_id tags = merge( @@ -87,7 +87,7 @@ resource "aws_route_table_association" "private" { # NATGW #--- resource "aws_eip" "nat" { - for_each = var.enable_igw && var.enable_nat ? local.availability_zones : {} + for_each = var.enable_igw && var.enable_nat ? local.availability_zones : toset([]) vpc = true tags = merge( @@ -131,14 +131,14 @@ resource "aws_nat_gateway" "nat" { } resource "aws_route" "nat_public" { - for_each = var.create_public_route_table && var.enable_igw && var.enable_nat ? local.availability_zones : {} + for_each = var.create_public_route_table && var.enable_igw && var.enable_nat ? local.availability_zones : toset([]) route_table_id = aws_route_table.public[each.key].id destination_cidr_block = "0.0.0.0/0" gateway_id = aws_internet_gateway.gateway[0].id } resource "aws_route" "nat_private" { - for_each = var.create_private_route_table && var.enable_igw && var.enable_nat ? local.availability_zones : {} + for_each = var.create_private_route_table && var.enable_igw && var.enable_nat ? local.availability_zones : toset([]) route_table_id = aws_route_table.private[each.key].id destination_cidr_block = "0.0.0.0/0" nat_gateway_id = aws_nat_gateway.nat[each.key].id