Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Feb 4, 2022
1 parent f0b66e2 commit edcc626
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions routing/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit edcc626

Please sign in to comment.