From 7b4eb078c6f6677bc08dd1537f0c5a2652b575cd Mon Sep 17 00:00:00 2001 From: Maarten Bezemer Date: Fri, 9 Dec 2016 16:21:16 +0100 Subject: [PATCH] Leave current secutiry groups as-is if not provided (#19043) --- lib/ansible/modules/cloud/amazon/elasticache.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/elasticache.py b/lib/ansible/modules/cloud/amazon/elasticache.py index 00098b171ef..a9bfd0073e1 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache.py +++ b/lib/ansible/modules/cloud/amazon/elasticache.py @@ -397,12 +397,13 @@ class ElastiCacheManager(object): return True # check vpc security groups - vpc_security_groups = [] - security_groups = self.data['SecurityGroups'] or [] - for sg in security_groups: - vpc_security_groups.append(sg['SecurityGroupId']) - if set(vpc_security_groups) != set(self.security_group_ids): - return True + if len(self.security_group_ids) > 0: + vpc_security_groups = [] + security_groups = self.data['SecurityGroups'] or [] + for sg in security_groups: + vpc_security_groups.append(sg['SecurityGroupId']) + if set(vpc_security_groups) != set(self.security_group_ids): + return True return False