Skip to content

Commit

Permalink
Ec2 transit gateway empty description (#2375)
Browse files Browse the repository at this point in the history
SUMMARY

When one or more TGWs exist with an empty description, the module will fail.
Fixes #2368

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_transit_gateway
ADDITIONAL INFORMATION

Apparently, ansible-collections/community.aws#2086 failed to merge, and the ec2_transit_gateway module has now been migrated to amazon.aws. This PR just cherry-picks the commits on top of this repo.

Reviewed-by: Alina Buzachis
Reviewed-by: GomathiselviS <[email protected]>
(cherry picked from commit 69d81d5)
  • Loading branch information
gravesm authored and patchback[bot] committed Nov 11, 2024
1 parent 8248f7d commit d122950
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/fix_tgw_description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ec2_transit_gateway - handle empty description while deleting transit gateway (https://github.com/ansible-collections/community.aws/pull/2086).
2 changes: 1 addition & 1 deletion plugins/modules/ec2_transit_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def get_matching_tgw(
tgws.extend(response)

for gateway in response:
if description == gateway["Description"] and gateway["State"] != "deleted":
if description == gateway.get("Description", "") and gateway["State"] != "deleted":
tgws.append(gateway)

if len(tgws) > 1:
Expand Down

0 comments on commit d122950

Please sign in to comment.