Fix for existing ENIs w/ multiple security groups

Do a sorted comparison of the list of security groups supplied via `module.params.get('security_groups')` and the list of security groups fetched via `get_sec_group_list(eni.groups)`.  This fixes an incorrect "The specified address is already in use" error if the order of security groups in those lists differ.
pull/18777/head
Dennis Conrad 9 years ago committed by Matt Clay
parent f56c557a93
commit 0254cbad9a

@ -322,7 +322,7 @@ def compare_eni(connection, module):
for eni in all_eni: for eni in all_eni:
remote_security_groups = get_sec_group_list(eni.groups) remote_security_groups = get_sec_group_list(eni.groups)
if (eni.subnet_id == subnet_id) and (eni.private_ip_address == private_ip_address) and (eni.description == description) and (remote_security_groups == security_groups): if (eni.subnet_id == subnet_id) and (eni.private_ip_address == private_ip_address) and (eni.description == description) and (sorted(remote_security_groups) == sorted(security_groups)):
return eni return eni
except BotoServerError as e: except BotoServerError as e:

Loading…
Cancel
Save