opentofu/examples/aws-networking/subnet/subnet.tf
Martin Atkins 0e3256b6f4 examples: creating VPCs and subnets across two regions
This example demonstrates both creating a network architecture *and* the
use of data resources to minimize the number of variables needed for a
child module by discovering additional data automatically.
2016-09-24 15:19:34 -07:00

14 lines
409 B
HCL

resource "aws_subnet" "main" {
cidr_block = "${cidrsubnet(data.aws_vpc.target.cidr_block, 4, lookup(var.az_numbers, data.aws_availability_zone.target.name_suffix))}"
vpc_id = "${var.vpc_id}"
}
resource "aws_route_table" "main" {
vpc_id = "${var.vpc_id}"
}
resource "aws_route_table_association" "main" {
subnet_id = "${aws_subnet.main.id}"
route_table_id = "${aws_route_table.main.id}"
}