github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/aws/r/route.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_route" 4 sidebar_current: "docs-aws-resource-route|" 5 description: |- 6 Provides a resource to create a routing entry in a VPC routing table. 7 --- 8 9 # aws\_route 10 11 Provides a resource to create a routing table entry (a route) in a VPC routing table. 12 13 ~> **NOTE on Route Tables and Routes:** Terraform currently 14 provides both a standalone Route resource and a [Route Table](route_table.html) resource with routes 15 defined in-line. At this time you cannot use a Route Table with in-line routes 16 in conjunction with any Route resources. Doing so will cause 17 a conflict of rule settings and will overwrite rules. 18 19 ## Example usage: 20 21 ```hcl 22 resource "aws_route" "r" { 23 route_table_id = "rtb-4fbb3ac4" 24 destination_cidr_block = "10.0.1.0/22" 25 vpc_peering_connection_id = "pcx-45ff3dc1" 26 depends_on = ["aws_route_table.testing"] 27 } 28 ``` 29 30 ##Example IPv6 Usage: 31 32 ```hcl 33 resource "aws_vpc" "vpc" { 34 cidr_block = "10.1.0.0/16" 35 assign_generated_ipv6_cidr_block = true 36 } 37 38 resource "aws_egress_only_internet_gateway" "egress" { 39 vpc_id = "${aws_vpc.vpc.id}" 40 } 41 42 resource "aws_route" "r" { 43 route_table_id = "rtb-4fbb3ac4" 44 destination_ipv6_cidr_block = "::/0" 45 egress_only_gateway_id = "${aws_egress_only_internet_gateway.egress.id}" 46 } 47 ``` 48 49 ## Argument Reference 50 51 The following arguments are supported: 52 53 * `route_table_id` - (Required) The ID of the routing table. 54 * `destination_cidr_block` - (Optional) The destination CIDR block. 55 * `destination_ipv6_cidr_block` - (Optional) The destination IPv6 CIDR block. 56 * `vpc_peering_connection_id` - (Optional) An ID of a VPC peering connection. 57 * `egress_only_gateway_id` - (Optional) An ID of a VPC Egress Only Internet Gateway. 58 * `gateway_id` - (Optional) An ID of a VPC internet gateway or a virtual private gateway. 59 * `nat_gateway_id` - (Optional) An ID of a VPC NAT gateway. 60 * `instance_id` - (Optional) An ID of an EC2 instance. 61 * `network_interface_id` - (Optional) An ID of a network interface. 62 63 Each route must contain either a `gateway_id`, `egress_only_gateway_id` a `nat_gateway_id`, an 64 `instance_id` or a `vpc_peering_connection_id` or a `network_interface_id`. 65 Note that the default route, mapping the VPC's CIDR block to "local", is 66 created implicitly and cannot be specified. 67 68 ## Attributes Reference 69 70 The following attributes are exported: 71 72 ~> **NOTE:** Only the target type that is specified (one of the above) 73 will be exported as an attribute once the resource is created. 74 75 * `route_table_id` - The ID of the routing table. 76 * `destination_cidr_block` - The destination CIDR block. 77 * `destination_ipv6_cidr_block` - The destination IPv6 CIDR block. 78 * `vpc_peering_connection_id` - An ID of a VPC peering connection. 79 * `egress_only_gateway_id` - An ID of a VPC Egress Only Internet Gateway. 80 * `gateway_id` - An ID of a VPC internet gateway or a virtual private gateway. 81 * `nat_gateway_id` - An ID of a VPC NAT gateway. 82 * `instance_id` - An ID of a NAT instance. 83 * `network_interface_id` - An ID of a network interface.