diff --git a/changelogs/fragments/fix_tgw_description.yml b/changelogs/fragments/fix_tgw_description.yml new file mode 100644 index 00000000000..e1bfea0a101 --- /dev/null +++ b/changelogs/fragments/fix_tgw_description.yml @@ -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). diff --git a/plugins/modules/ec2_transit_gateway.py b/plugins/modules/ec2_transit_gateway.py index f2dbd118f95..23859f6234d 100644 --- a/plugins/modules/ec2_transit_gateway.py +++ b/plugins/modules/ec2_transit_gateway.py @@ -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: