Skip to content

Commit

Permalink
ec2_vpc_route_table: Add support for Route entry for Carrier Gateway (#…
Browse files Browse the repository at this point in the history
…926)

ec2_vpc_route_table: Add support for Route entry for Carrier Gateway

SUMMARY
Add support for VPC Carrear Gateways entry on route table.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME

module/ec2_vpc_route_table

ADDITIONAL INFORMATION
Support Carrier Gateway route on Route Table module using the same strategy of  Nat GW, discovering the prefix of resource name cagw-.
Not directly related, but testing in the same solution the cagw modules: ansible-collections/community.aws#1353

ec2_carrier_gateway
ec2_carrier_gateway_info

Reviewed-by: Mark Chappell
Reviewed-by: Marco Braga
  • Loading branch information
mtulio authored Mar 31, 2023
1 parent 8acb076 commit e1b2dc7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/926-ec2_vpc_route_table.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ec2_vpc_route_table - add support for Carrier Gateway entry (https://github.com/ansible-collections/amazon.aws/pull/926).
8 changes: 8 additions & 0 deletions plugins/modules/ec2_vpc_route_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@
returned: when the route is via a NAT gateway
type: str
sample: local
carrier_gateway_id:
description: ID of the Carrier gateway.
returned: when the route is via a Carrier gateway
type: str
sample: local
version_added: 6.0.0
origin:
description: mechanism through which the route is in the table.
returned: always
Expand Down Expand Up @@ -708,6 +714,8 @@ def create_route_spec(connection, module, vpc_id):
route_spec['gateway_id'] = igw
if route_spec.get('gateway_id') and route_spec['gateway_id'].startswith('nat-'):
rename_key(route_spec, 'gateway_id', 'nat_gateway_id')
if route_spec.get('gateway_id') and route_spec['gateway_id'].startswith('cagw-'):
rename_key(route_spec, 'gateway_id', 'carrier_gateway_id')

return snake_dict_to_camel_dict(routes, capitalize_first=True)

Expand Down

0 comments on commit e1b2dc7

Please sign in to comment.