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.
This commit is contained in:
Dennis Conrad 2016-03-17 17:08:40 +00:00 committed by Matt Clay
parent f56c557a93
commit 0254cbad9a

View file

@ -322,7 +322,7 @@ def compare_eni(connection, module):
for eni in all_eni:
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
except BotoServerError as e: