github.com/lymingtonprecision/terraform@v0.9.9-0.20170613092852-62acef9611a9/website/source/docs/providers/aws/r/route_table.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_route_table"
     4  sidebar_current: "docs-aws-resource-route-table|"
     5  description: |-
     6    Provides a resource to create a VPC routing table.
     7  ---
     8  
     9  # aws\_route\_table
    10  
    11  Provides a resource to create a VPC routing table.
    12  
    13  ~> **NOTE on Route Tables and Routes:** Terraform currently
    14  provides both a standalone [Route resource](route.html) and a Route Table 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  ~> **NOTE on `gateway_id` and `nat_gateway_id`:** The AWS API is very foregiving with these two
    20  attributes and the `aws_route_table` resource can be created with a NAT ID specified as a Gateway ID attribute.
    21  This _will_ lead to a permanent diff between your configuration and statefile, as the API returns the correct
    22  parameters in the returned route table. If you're experiencing constant diffs in your `aws_route_table` resources,
    23  the first thing to check is whether or not you're specifying a NAT ID instead of a Gateway ID, or vice-versa.
    24  
    25  ~> **NOTE on `propagating_vgws` and the `aws_vpn_gateway_route_propagation` resource:**
    26  If the `propagating_vgws` argument is present, it's not supported to _also_
    27  define route propagations using `aws_vpn_gateway_route_propagation`, since
    28  this resource will delete any propagating gateways not explicitly listed in
    29  `propagating_vgws`. Omit this argument when defining route propagation using
    30  the separate resource.
    31  
    32  ## Example usage with tags:
    33  
    34  ```hcl
    35  resource "aws_route_table" "r" {
    36    vpc_id = "${aws_vpc.default.id}"
    37  
    38    route {
    39      cidr_block = "10.0.1.0/24"
    40      gateway_id = "${aws_internet_gateway.main.id}"
    41    }
    42  
    43    route {
    44      ipv6_cidr_block = "::/0"
    45      egress_only_gateway_id = "${aws_egress_only_internet_gateway.foo.id}"
    46    }
    47  
    48    tags {
    49      Name = "main"
    50    }
    51  }
    52  ```
    53  
    54  ## Argument Reference
    55  
    56  The following arguments are supported:
    57  
    58  * `vpc_id` - (Required) The VPC ID.
    59  * `route` - (Optional) A list of route objects. Their keys are documented below.
    60  * `tags` - (Optional) A mapping of tags to assign to the resource.
    61  * `propagating_vgws` - (Optional) A list of virtual gateways for propagation.
    62  
    63  Each route supports the following:
    64  
    65  * `cidr_block` - (Optional) The CIDR block of the route.
    66  * `ipv6_cidr_block` - Optional) The Ipv6 CIDR block of the route
    67  * `egress_only_gateway_id` - (Optional) The Egress Only Internet Gateway ID.
    68  * `gateway_id` - (Optional) The Internet Gateway ID.
    69  * `nat_gateway_id` - (Optional) The NAT Gateway ID.
    70  * `instance_id` - (Optional) The EC2 instance ID.
    71  * `vpc_peering_connection_id` - (Optional) The VPC Peering ID.
    72  * `network_interface_id` - (Optional) The ID of the elastic network interface (eni) to use.
    73  
    74  Each route must contain either a `gateway_id`, an `instance_id`, a `nat_gateway_id`, a
    75  `vpc_peering_connection_id` or a `network_interface_id`. Note that the default route, mapping
    76  the VPC's CIDR block to "local", is created implicitly and cannot be specified.
    77  
    78  ## Attributes Reference
    79  
    80  The following attributes are exported:
    81  ~> **NOTE:** Only the target that is entered is exported as a readable
    82  attribute once the route resource is created.
    83  
    84  * `id` - The ID of the routing table
    85  
    86  ## Import
    87  
    88  Route Tables can be imported using the `route table id`, e.g.
    89  
    90  ```
    91  $ terraform import aws_route_table.public_rt rtb-22574640
    92  ```