Skip to content

Commit 2466b6d

Browse files
committed
Add support for Multiple NAT gateways
1 parent 05ab07d commit 2466b6d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/nat/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
resource "aws_eip" "nat" {
22
vpc = true
33

4-
#count = "${length(var.azs)}" # Comment out count to only have 1 NAT
4+
count = "${length(var.azs)}" # Comment out count to only have 1 NAT
55

66
lifecycle {
77
create_before_destroy = true
88
}
99
}
1010

1111
resource "aws_nat_gateway" "nat" {
12+
count = "${length(var.azs)}" # Comment out count to only have 1 NAT
13+
1214
allocation_id = "${element(aws_eip.nat.*.id, count.index)}"
1315
subnet_id = "${element(split(",", var.public_subnet_ids), count.index)}"
1416

15-
#count = "${length(split(",", var.azs))}" # Comment out count to only have 1 NAT
16-
1717
lifecycle {
1818
create_before_destroy = true
1919
}

0 commit comments

Comments
 (0)