Skip to content

Commit

Permalink
Merge pull request #17347 from ewbankkit/f-d/aws_route_table-managed_…
Browse files Browse the repository at this point in the history
…prefix_list-destination

d/aws_route_table: 'destination_prefix_list_id' attribute set for managed prefix list destinations
  • Loading branch information
YakDriver authored Mar 30, 2021
2 parents 2bf0416 + 9b22967 commit 5fa74d0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/17347.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-notes:enhancement
data-source/aws_route_table: Add `destination_prefix_list_id` attribute
```
10 changes: 9 additions & 1 deletion aws/data_source_aws_route_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func dataSourceAwsRouteTable() *schema.Resource {
Computed: true,
},

"destination_prefix_list_id": {
Type: schema.TypeString,
Computed: true,
},

///
// Targets.
///
Expand Down Expand Up @@ -246,7 +251,7 @@ func dataSourceRoutesRead(ec2Routes []*ec2.Route) []map[string]interface{} {
continue
}

if r.DestinationPrefixListId != nil {
if r.DestinationPrefixListId != nil && strings.HasPrefix(aws.StringValue(r.GatewayId), "vpce-") {
// Skipping because VPC endpoint routes are handled separately
// See aws_vpc_endpoint
continue
Expand All @@ -260,6 +265,9 @@ func dataSourceRoutesRead(ec2Routes []*ec2.Route) []map[string]interface{} {
if r.DestinationIpv6CidrBlock != nil {
m["ipv6_cidr_block"] = *r.DestinationIpv6CidrBlock
}
if r.DestinationPrefixListId != nil {
m["destination_prefix_list_id"] = *r.DestinationPrefixListId
}
if r.CarrierGatewayId != nil {
m["carrier_gateway_id"] = *r.CarrierGatewayId
}
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/route_table.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ When relevant, routes are also exported with the following attributes:
For destinations:

* `cidr_block` - CIDR block of the route.
* `destination_prefix_list_id` - The ID of a [managed prefix list](ec2_managed_prefix_list.html) destination of the route.
* `ipv6_cidr_block` - IPv6 CIDR block of the route.

For targets:
Expand Down

0 comments on commit 5fa74d0

Please sign in to comment.