github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/d/route_table.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_route_table"
     4  sidebar_current: "docs-aws-datasource-route-table"
     5  description: |-
     6      Provides details about a specific Route Table
     7  ---
     8  
     9  # aws\_route\_table
    10  
    11  `aws_route_table` provides details about a specific Route Table.
    12  
    13  This resource can prove useful when a module accepts a Subnet id as
    14  an input variable and needs to, for example, add a route in
    15  the Route Table.
    16  
    17  ## Example Usage
    18  
    19  The following example shows how one might accept a Route Table id as a variable
    20  and use this data source to obtain the data necessary to create a route.
    21  
    22  ```hcl
    23  variable "subnet_id" {}
    24  
    25  data "aws_route_table" "selected" {
    26    subnet_id = "${var.subnet_id}"
    27  }
    28  
    29  resource "aws_route" "route" {
    30    route_table_id            = "${data.aws_route_table.selected.id}"
    31    destination_cidr_block    = "10.0.1.0/22"
    32    vpc_peering_connection_id = "pcx-45ff3dc1"
    33  }
    34  ```
    35  
    36  ## Argument Reference
    37  
    38  The arguments of this data source act as filters for querying the available
    39  Route Table in the current region. The given filters must match exactly one
    40  Route Table whose data will be exported as attributes.
    41  
    42  
    43  * `filter` - (Optional) Custom filter block as described below.
    44  
    45  * `route_table_id` - (Optional) The id of the specific Route Table to retrieve.
    46  
    47  * `tags` - (Optional) A mapping of tags, each pair of which must exactly match
    48    a pair on the desired Route Table.
    49  
    50  * `vpc_id` - (Optional) The id of the VPC that the desired Route Table belongs to.
    51  
    52  * `subnet_id` - (Optional) The id of a Subnet which is connected to the Route Table (not be exported if not given in parameter).
    53  
    54  More complex filters can be expressed using one or more `filter` sub-blocks,
    55  which take the following arguments:
    56  
    57  * `name` - (Required) The name of the field to filter by, as defined by
    58    [the underlying AWS API](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeRouteTables.html).
    59  
    60  * `values` - (Required) Set of values that are accepted for the given field.
    61    A Route Table will be selected if any one of the given values matches.
    62  
    63  ## Attributes Reference
    64  
    65  All of the argument attributes except `filter` and `subnet_id` blocks are also exported as
    66  result attributes. This data source will complete the data by populating
    67  any fields that are not included in the configuration with the data for
    68  the selected Route Table.
    69  
    70  `routes` are also exported with the following attributes, when there are relevants:
    71  Each route supports the following:
    72  
    73  * `cidr_block` - The CIDR block of the route.
    74  * `ipv6_cidr_block` - The IPv6 CIDR block of the route.
    75  * `egress_only_gateway_id` - The ID of the Egress Only Internet Gateway.
    76  * `gateway_id` - The Internet Gateway ID.
    77  * `nat_gateway_id` - The NAT Gateway ID.
    78  * `instance_id` - The EC2 instance ID.
    79  * `vpc_peering_connection_id` - The VPC Peering ID.
    80  * `network_interface_id` - The ID of the elastic network interface (eni) to use.
    81  
    82  
    83  `associations` are also exported with the following attributes:
    84  
    85  * `route_table_association_id` - The Association ID .
    86  * `route_table_id` - The Route Table ID.
    87  * `subnet_id` - The Subnet ID.
    88  * `main` - If the Association due to the Main Route Table.