W3cubDocs

/Terraform

aws_route

Provides a resource to create a routing table entry (a route) in a VPC routing table.

Example usage:

resource "aws_route" "r" {
  route_table_id            = "rtb-4fbb3ac4"
  destination_cidr_block    = "10.0.1.0/22"
  vpc_peering_connection_id = "pcx-45ff3dc1"
  depends_on                = ["aws_route_table.testing"]
}

Example IPv6 Usage:

resource "aws_vpc" "vpc" {
  cidr_block = "10.1.0.0/16"
  assign_generated_ipv6_cidr_block = true
}

resource "aws_egress_only_internet_gateway" "egress" {
  vpc_id = "${aws_vpc.vpc.id}"
}

resource "aws_route" "r" {
  route_table_id               = "rtb-4fbb3ac4"
  destination_ipv6_cidr_block  = "::/0"
  egress_only_gateway_id = "${aws_egress_only_internet_gateway.egress.id}"
}

Argument Reference

The following arguments are supported:

Each route must contain either a gateway_id, egress_only_gateway_id a nat_gateway_id, an instance_id or 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

In addition to all arguments above, the following attributes are exported:

Timeouts

aws_route provides the following Timeouts configuration options:

  • create - (Default 2 minutes) Used for route creation
  • delete - (Default 5 minutes) Used for route deletion

© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/route.html