mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
ec2_group - fix VPC precedence for security group targets (#45787)
Update the dictionary with the preferred values last to get the right order of VPC precedence Fixes #45782
This commit is contained in:
parent
06e2e0e040
commit
8d2df9be52
2 changed files with 9 additions and 0 deletions
|
@ -855,6 +855,9 @@ def group_exists(client, module, vpc_id, group_id, name):
|
|||
if security_groups:
|
||||
groups = dict((group['GroupId'], group) for group in all_groups)
|
||||
groups.update(dict((group['GroupName'], group) for group in all_groups))
|
||||
if vpc_id:
|
||||
vpc_wins = dict((group['GroupName'], group) for group in all_groups if group['VpcId'] == vpc_id)
|
||||
groups.update(vpc_wins)
|
||||
# maintain backwards compatibility by using the last matching group
|
||||
return security_groups[-1], groups
|
||||
return None, {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue