2015-06-24 05:44:02 +02:00
|
|
|
---
|
|
|
|
layout: "aws"
|
2015-10-26 18:26:47 +01:00
|
|
|
page_title: "AWS: aws_route"
|
|
|
|
sidebar_current: "docs-aws-resource-route|"
|
2015-06-24 05:44:02 +02:00
|
|
|
description: |-
|
|
|
|
Provides a resource to create a routing entry in a VPC routing table.
|
|
|
|
---
|
|
|
|
|
|
|
|
# aws\_route
|
|
|
|
|
|
|
|
Provides a resource to create a routing table entry (a route) in a VPC routing table.
|
|
|
|
|
2015-10-15 23:55:47 +02:00
|
|
|
~> **NOTE on Route Tables and Routes:** Terraform currently
|
2016-04-01 05:30:54 +02:00
|
|
|
provides both a standalone Route resource and a [Route Table](route_table.html) resource with routes
|
2015-10-15 23:55:47 +02:00
|
|
|
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.
|
|
|
|
|
2015-06-24 05:44:02 +02:00
|
|
|
## Example usage:
|
|
|
|
|
2017-04-17 12:17:54 +02:00
|
|
|
```hcl
|
2015-06-24 05:44:02 +02:00
|
|
|
resource "aws_route" "r" {
|
2017-02-18 23:48:50 +01:00
|
|
|
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"]
|
2015-06-24 05:44:02 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2017-03-14 11:41:40 +01:00
|
|
|
##Example IPv6 Usage:
|
|
|
|
|
2017-04-17 12:17:54 +02:00
|
|
|
```hcl
|
2017-03-14 11:41:40 +01:00
|
|
|
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}"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-06-24 05:44:02 +02:00
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `route_table_id` - (Required) The ID of the routing table.
|
2017-03-14 11:41:40 +01:00
|
|
|
* `destination_cidr_block` - (Optional) The destination CIDR block.
|
|
|
|
* `destination_ipv6_cidr_block` - (Optional) The destination IPv6 CIDR block.
|
2015-06-24 05:44:02 +02:00
|
|
|
* `vpc_peering_connection_id` - (Optional) An ID of a VPC peering connection.
|
2017-03-14 11:41:40 +01:00
|
|
|
* `egress_only_gateway_id` - (Optional) An ID of a VPC Egress Only Internet Gateway.
|
2015-06-24 05:44:02 +02:00
|
|
|
* `gateway_id` - (Optional) An ID of a VPC internet gateway or a virtual private gateway.
|
2015-12-18 08:20:13 +01:00
|
|
|
* `nat_gateway_id` - (Optional) An ID of a VPC NAT gateway.
|
2016-03-09 22:05:08 +01:00
|
|
|
* `instance_id` - (Optional) An ID of an EC2 instance.
|
2015-06-24 05:44:02 +02:00
|
|
|
* `network_interface_id` - (Optional) An ID of a network interface.
|
|
|
|
|
2017-03-14 11:41:40 +01:00
|
|
|
Each route must contain either a `gateway_id`, `egress_only_gateway_id` a `nat_gateway_id`, an
|
2015-12-18 08:20:13 +01:00
|
|
|
`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.
|
2015-06-24 05:44:02 +02:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported:
|
|
|
|
|
|
|
|
~> **NOTE:** Only the target type that is specified (one of the above)
|
|
|
|
will be exported as an attribute once the resource is created.
|
|
|
|
|
|
|
|
* `route_table_id` - The ID of the routing table.
|
|
|
|
* `destination_cidr_block` - The destination CIDR block.
|
2017-03-14 11:41:40 +01:00
|
|
|
* `destination_ipv6_cidr_block` - The destination IPv6 CIDR block.
|
2015-06-24 05:44:02 +02:00
|
|
|
* `vpc_peering_connection_id` - An ID of a VPC peering connection.
|
2017-03-14 11:41:40 +01:00
|
|
|
* `egress_only_gateway_id` - An ID of a VPC Egress Only Internet Gateway.
|
2015-06-24 05:44:02 +02:00
|
|
|
* `gateway_id` - An ID of a VPC internet gateway or a virtual private gateway.
|
2015-12-18 08:20:13 +01:00
|
|
|
* `nat_gateway_id` - An ID of a VPC NAT gateway.
|
2015-06-24 05:44:02 +02:00
|
|
|
* `instance_id` - An ID of a NAT instance.
|
|
|
|
* `network_interface_id` - An ID of a network interface.
|