FEATURES OPEN SOURCE ABOUT DOCS LOGIN REGISTER

aws_route_table

Provides a resource to create a VPC routing table.

~> NOTE on Route Tables and Routes: Terraform currently provides both a standalone Route resource and a Route Table resource with routes defined in-line. At this time you cannot use a Route Table with in-line routes in conjunction with any Route resources. Doing so will cause a conflict of rule settings and will overwrite rules.

Example usage with tags:

resource "aws_route_table" "r" {
    vpc_id = "${aws_vpc.default.id}"
    route {
        cidr_block = "10.0.1.0/24"
        gateway_id = "${aws_internet_gateway.main.id}"
    }

	tags {
		Name = "main"
	}
}

Argument Reference

The following arguments are supported:

Each route supports the following:

Each route must contain either a gateway_id, an instance_id, a nat_gateway_id, a vpc_peering_connection_id or a network_interface_id. Note that the default route, mapping the VPC’s CIDR block to “local”, is created implicitly and cannot be specified.

Attributes Reference

The following attributes are exported: ~> NOTE: Only the target that is entered is exported as a readable attribute once the route resource is created.

Import

Route Tables can be imported using the route table id, e.g.

$ terraform import aws_route_table.public_rt rtb-22574640

See the source of this document at Terraform.io