terraform-community-modules / tf_aws_vpc

[DEPRECATED] Use https://github.com/terraform-aws-modules/terraform-aws-vpc
Other
211 stars 203 forks source link

Error if single_nat_gateway is false? #61

Closed jcomeaux closed 7 years ago

jcomeaux commented 7 years ago

So, I don't have a public subnet in my vpc...i think that's why i'm having this problem

I'm seeing this error unless i set single_nat_gateway to true:

* module.vpc_base.aws_nat_gateway.natgw: 3 error(s) occurred:
* module.vpc_base.aws_nat_gateway.natgw[1]: element: element() may not be used with an empty list in:
${element(aws_subnet.public.*.id, (var.single_nat_gateway ? 0 : count.index))}
* module.vpc_base.aws_nat_gateway.natgw[2]: element: element() may not be used with an empty list in:
${element(aws_subnet.public.*.id, (var.single_nat_gateway ? 0 : count.index))}
* module.vpc_base.aws_nat_gateway.natgw[0]: element: element() may not be used with an empty list in:
${element(aws_subnet.public.*.id, (var.single_nat_gateway ? 0 : count.index))}
cgswong commented 7 years ago

For a properly functioning NAT Gateway you do need a public subnet however. Reference the AWS NAT Gateway documentation.

To create a NAT gateway, you must specify the public subnet in which the NAT gateway will reside.

The NAT gateway must be in a public subnet with a route table that routes Internet traffic to an Internet gateway.

jcomeaux commented 7 years ago

Ah...sure enough. Well, I'd say let's close this one...thanks :)