Specifies a route table for the specified VPC. After you create a route table, you can add routes and associate the table with a subnet. For more information, see Route tables in the Amazon VPC User Guide.
resource "awscc_ec2_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_route_table" "custom_route_table" {
vpc_id = awscc_ec2_vpc.vpc.id
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_route_table" "custom_route_table" {
vpc_id = awscc_ec2_vpc.vpc.id
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_subnet" "subnet1" {
vpc_id = awscc_ec2_vpc.vpc.id
cidr_block = "10.0.101.0/24"
availability_zone = "us-east-1a"
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "awscc_ec2_subnet_route_table_association" "subnet_route_table_association" {
route_table_id = awscc_ec2_route_table.custom_route_table.id
subnet_id = awscc_ec2_subnet.subnet1.id
}
resource "awscc_ec2_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
tags = [{
key = "Managed By"
value = "AWSCC"
}]
}
resource "aws_internet_gateway" "internet_gateway" {
vpc_id = awscc_ec2_vpc.vpc.id
}
resource "aws_route_table" "public_route_table" {
vpc_id = awscc_ec2_vpc.vpc.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.internet_gateway.id
}
}
vpc_id
(String) The ID of the VPC.tags
(Attributes List) Any tags assigned to the route table. (see below for nested schema)id
(String) Uniquely identifies the resource.route_table_id
(String)tags
Required:
key
(String) The tag key.value
(String) The tag value.Import is supported using the following syntax:
$ terraform import awscc_ec2_route_table.example <resource ID>