Skip to content

Commit

Permalink
Merge pull request #2 from n8io/bug/enable-nat-gateway-interpolation
Browse files Browse the repository at this point in the history
🐛 terraform-community-modules#47  Fix issue with string vs bool value with enable_nat_gateway input
  • Loading branch information
n8io authored Jul 23, 2017
2 parents 37ea078 + 4293614 commit e15fdbf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resource "aws_route" "private_nat_gateway" {
route_table_id = "${element(aws_route_table.private.*.id, count.index)}"
destination_cidr_block = "0.0.0.0/0"
nat_gateway_id = "${element(aws_nat_gateway.natgw.*.id, count.index)}"
count = "${length(var.azs) * lookup(map(var.enable_nat_gateway, 1), "true", 0)}"
count = "${length(var.azs) * lookup(map("true", 1, "1", 1), var.enable_nat_gateway, 0)}"
}

resource "aws_route_table" "private" {
Expand Down Expand Up @@ -88,13 +88,13 @@ resource "aws_subnet" "public" {

resource "aws_eip" "nateip" {
vpc = true
count = "${length(var.azs) * lookup(map(var.enable_nat_gateway, 1), "true", 0)}"
count = "${length(var.azs) * lookup(map("true", 1, "1", 1), var.enable_nat_gateway, 0)}"
}

resource "aws_nat_gateway" "natgw" {
allocation_id = "${element(aws_eip.nateip.*.id, count.index)}"
subnet_id = "${element(aws_subnet.public.*.id, count.index)}"
count = "${length(var.azs) * lookup(map(var.enable_nat_gateway, 1), "true", 0)}"
count = "${length(var.azs) * lookup(map("true", 1, "1", 1), var.enable_nat_gateway, 0)}"

depends_on = ["aws_internet_gateway.mod"]
}
Expand Down

0 comments on commit e15fdbf

Please sign in to comment.