Skip to content

Commit

Permalink
ec2_vpc_peer - Fix idempotency when accepter/requester is reversed (a…
Browse files Browse the repository at this point in the history
…nsible-collections#1346)

ec2_vpc_peer - Fix idempotency when accepter/requester is reversed

SUMMARY
fixes: ansible-collections#580
Fixes a bug where a new peering request would be created when the accepter/requester is reversed
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/ec2_vpc_peer.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
tremble authored Jul 12, 2022
1 parent d19f8c4 commit 96494c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ec2_vpc_peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ def describe_peering_connections(params, client):
Filters=ansible_dict_to_boto3_filter_list(peer_filter),
)
if result['VpcPeeringConnections'] == []:
# Try again with the VPC/Peer relationship reversed
peer_filter = {
'requester-vpc-info.vpc-id': params['PeerVpcId'],
'accepter-vpc-info.vpc-id': params['VpcId'],
}
result = client.describe_vpc_peering_connections(
aws_retry=True,
Filters=ansible_dict_to_boto3_filter_list(peer_filter),
Expand Down

0 comments on commit 96494c2

Please sign in to comment.