Skip to content

Commit

Permalink
ds/route: Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed Mar 26, 2021
1 parent 790d401 commit c679cff
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 39 deletions.
10 changes: 1 addition & 9 deletions aws/data_source_aws_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func dataSourceAwsRoute() *schema.Resource {
Optional: true,
Computed: true,
},

"destination_ipv6_cidr_block": {
Type: schema.TypeString,
Optional: true,
Expand All @@ -43,49 +42,41 @@ func dataSourceAwsRoute() *schema.Resource {
Optional: true,
Computed: true,
},

"egress_only_gateway_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"gateway_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"instance_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"local_gateway_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"nat_gateway_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"network_interface_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"transit_gateway_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"vpc_peering_connection_id": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -181,6 +172,7 @@ func dataSourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error {
} else if destination := aws.StringValue(route.DestinationIpv6CidrBlock); destination != "" {
d.SetId(tfec2.RouteCreateID(routeTableID, destination))
}

d.Set("carrier_gateway_id", route.CarrierGatewayId)
d.Set("destination_cidr_block", route.DestinationCidrBlock)
d.Set("destination_ipv6_cidr_block", route.DestinationIpv6CidrBlock)
Expand Down
48 changes: 18 additions & 30 deletions website/docs/d/route.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ description: |-

`aws_route` provides details about a specific Route.

This resource can prove useful when finding the resource
associated with a CIDR. For example, finding the peering
connection associated with a CIDR value.
This resource can prove useful when finding the resource associated with a CIDR. For example, finding the peering connection associated with a CIDR value.

## Example Usage

The following example shows how one might use a CIDR value to find a network interface id
and use this to create a data source of that network interface.
The following example shows how one might use a CIDR value to find a network interface id and use this to create a data source of that network interface.

```terraform
variable "subnet_id" {}
Expand All @@ -38,35 +35,26 @@ data "aws_network_interface" "interface" {

## Argument Reference

The arguments of this data source act as filters for querying the available
Route in the current region. The given filters must match exactly one
Route whose data will be exported as attributes.
The arguments of this data source act as filters for querying the available Route in the current region. The given filters must match exactly oneRoute whose data will be exported as attributes.

* `route_table_id` - (Required) The id of the specific Route Table containing the Route entry.
The following arguments are required:

* `destination_cidr_block` - (Optional) The CIDR block of the Route belonging to the Route Table.
* `route_table_id` - (Required) The ID of the specific Route Table containing the Route entry.

* `destination_ipv6_cidr_block` - (Optional) The IPv6 CIDR block of the Route belonging to the Route Table.
The following arguments are optional:

* `egress_only_gateway_id` - (Optional) The Egress Only Gateway ID of the Route belonging to the Route Table.

* `gateway_id` - (Optional) The Gateway ID of the Route belonging to the Route Table.

* `instance_id` - (Optional) The Instance ID of the Route belonging to the Route Table.

* `nat_gateway_id` - (Optional) The NAT Gateway ID of the Route belonging to the Route Table.

* `local_gateway_id` - (Optional) The Local Gateway ID of the Route belonging to the Route Table.

* `transit_gateway_id` - (Optional) The EC2 Transit Gateway ID of the Route belonging to the Route Table.

* `vpc_peering_connection_id` - (Optional) The VPC Peering Connection ID of the Route belonging to the Route Table.

* `network_interface_id` - (Optional) The Network Interface ID of the Route belonging to the Route Table.

* `carrier_gateway_id` - (Optional) The EC2 Carrier Gateway ID of the Route belonging to the Route Table.
* `carrier_gateway_id` - (Optional) EC2 Carrier Gateway ID of the Route belonging to the Route Table.
* `destination_cidr_block` - (Optional) CIDR block of the Route belonging to the Route Table.
* `destination_ipv6_cidr_block` - (Optional) IPv6 CIDR block of the Route belonging to the Route Table.
* `egress_only_gateway_id` - (Optional) Egress Only Gateway ID of the Route belonging to the Route Table.
* `gateway_id` - (Optional) Gateway ID of the Route belonging to the Route Table.
* `instance_id` - (Optional) Instance ID of the Route belonging to the Route Table.
* `local_gateway_id` - (Optional) Local Gateway ID of the Route belonging to the Route Table.
* `nat_gateway_id` - (Optional) NAT Gateway ID of the Route belonging to the Route Table.
* `network_interface_id` - (Optional) Network Interface ID of the Route belonging to the Route Table.
* `transit_gateway_id` - (Optional) EC2 Transit Gateway ID of the Route belonging to the Route Table.
* `vpc_peering_connection_id` - (Optional) VPC Peering Connection ID of the Route belonging to the Route Table.

## Attributes Reference

All of the argument attributes are also exported as
result attributes when there is data available. For example, the `vpc_peering_connection_id` field will be empty when the route is attached to a Network Interface.
All of the argument attributes are also exported as result attributes when there is data available. For example, the `vpc_peering_connection_id` field will be empty when the route is attached to a Network Interface.

0 comments on commit c679cff

Please sign in to comment.