Answer the question
In order to leave comments, you need to log in
Why does Terraform require either nat instance id or instance id or internet gateway id?
Good time of the day!
Question about aws and Terraform. When I create a private subnet, I try to add a default route to it for the entire VPC, like this:
from
main.tf file
resource "aws_subnet" "Private_Subnet3" {
vpc_id = "${aws_vpc.Main_VPC.id}"
cidr_block = "${ var.private_subnet3_cidr}"
availability_zone = "${var.Availability_Zone_B}"
tags {
Name = "Private Subnet 3"
}
}
resource "aws_route_table" "private-rt" {
vpc_id = "${aws_vpc.Main_VPC.id}"
route {
cidr_block = "${var.Main_VPC.cidr_block}"
}
tags {
Name = "
resource "aws_route_table_association" "private-rt" {
subnet_id = "${aws_subnet.Private_Subnet3.id}"
route_table_id = "${aws_route_table.private-rt.id}"
}
I get a runtime error where it says nat instance id or instance id must be
defined
.
Answer the question
In order to leave comments, you need to log in
I'm not good at terraforming and you didn't provide information about resources - vpc, subnet, rt .... But I have a wild suspicion that you either have a subnet not in a vpc, or in general everything is in different regions or something else with a location . Nat / ig are needed when you need to bring traffic out of the vpc and back
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question