» aws_route_table

Provides a resource to create a VPC routing table.

» Example usage with tags:

resource "aws_route_table" "r" {
  vpc_id = "${aws_vpc.default.id}"

  route {
    cidr_block = ""
    gateway_id = "${aws_internet_gateway.main.id}"

  route {
    ipv6_cidr_block        = "::/0"
    egress_only_gateway_id = "${aws_egress_only_internet_gateway.foo.id}"

  tags = {
    Name = "main"

» Argument Reference

The following arguments are supported:

  • vpc_id - (Required) The VPC ID.
  • route - (Optional) A list of route objects. Their keys are documented below.
  • tags - (Optional) A mapping of tags to assign to the resource.
  • propagating_vgws - (Optional) A list of virtual gateways for propagation.

» route Argument Reference

One of the following destination arguments must be supplied:

One of the following target arguments must be supplied:

Note that the default route, mapping the VPC's CIDR block to "local", is created implicitly and cannot be specified.

» Attributes Reference

In addition to all arguments above, the following attributes are exported: ~> NOTE: Only the target that is entered is exported as a readable attribute once the route resource is created.

  • id - The ID of the routing table
  • owner_id - The ID of the AWS account that owns the route table

» Import

Route Tables can be imported using the route table id. For example, to import route table rtb-4e616f6d69, use this command:

$ terraform import aws_route_table.public_rt rtb-4e616f6d69