Skip to content

Commit

Permalink
Fix broken ec2_vpc_vgw tests (ansible-collections#1579)
Browse files Browse the repository at this point in the history
Fix broken ec2_vpc_vgw tests

SUMMARY
The APIs are no longer consistently returning deleted attachments.  Accept both the attachment being listed but marked 'deleted', and not being listed.
Amazon's APIs used to be very slow to update this, making waiting for it a bad idea.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_vpc_vgw
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@cea2ab5
  • Loading branch information
tremble authored and alinabuzachis committed Oct 23, 2024
1 parent a876efa commit d78d6d8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/integration/targets/ec2_vpc_vgw/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@
- vgw_details.state == 'available'
- '"Name" in vgw_details.resource_tags'
- vgw_details.resource_tags.Name == vgw_name
- vgw_details.vpc_attachments | length == 2
- attach_1_description in vgw_details.vpc_attachments
- (
attach_1_description in vgw_details.vpc_attachments
and
vgw_details.vpc_attachments | length == 2
) or ( vgw_details.vpc_attachments | length == 1 )
- attach_2_description in vgw_details.vpc_attachments

- name: get VPC VGW facts by Tag
Expand Down Expand Up @@ -138,8 +141,11 @@
- vgw_details.state == 'available'
- '"Name" in vgw_details.resource_tags'
- vgw_details.resource_tags.Name == vgw_name
- vgw_details.vpc_attachments | length == 2
- attach_1_description in vgw_details.vpc_attachments
- (
attach_1_description in vgw_details.vpc_attachments
and
vgw_details.vpc_attachments | length == 2
) or ( vgw_details.vpc_attachments | length == 1 )
- attach_2_description in vgw_details.vpc_attachments

# ============================================================
Expand Down Expand Up @@ -211,7 +217,7 @@
- name: delete vpn gateway
ec2_vpc_vgw:
state: absent
vpn_gateway_id: '{{ vgw.vgw.id }}'
vpn_gateway_id: '{{ vgw.vgw.id | default(vgw_id) }}'
ignore_errors: yes

- name: delete vpc
Expand Down

0 comments on commit d78d6d8

Please sign in to comment.