From fda09a75d3c674d61bd41e9acbc42a573fb6738a Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Tue, 30 Jan 2018 16:12:22 -0500 Subject: [PATCH] elasticache: default zone to None - fixes #31779 (#31785) * elasticache: default zone to None. * Only add PreferredAvailabilityZone to kwargs if self.zone is not None --- lib/ansible/modules/cloud/amazon/elasticache.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/elasticache.py b/lib/ansible/modules/cloud/amazon/elasticache.py index cbb09cc026d..416d5a8c3ce 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache.py +++ b/lib/ansible/modules/cloud/amazon/elasticache.py @@ -218,10 +218,11 @@ class ElastiCacheManager(object): CacheSecurityGroupNames=self.cache_security_groups, SecurityGroupIds=self.security_group_ids, CacheParameterGroupName=self.cache_parameter_group, - CacheSubnetGroupName=self.cache_subnet_group, - PreferredAvailabilityZone=self.zone) + CacheSubnetGroupName=self.cache_subnet_group) if self.cache_port is not None: kwargs['Port'] = self.cache_port + if self.zone is not None: + kwargs['PreferredAvailabilityZone'] = self.zone try: self.conn.create_cache_cluster(**kwargs) @@ -497,7 +498,7 @@ def main(): cache_subnet_group=dict(default=""), cache_security_groups=dict(default=[], type='list'), security_group_ids=dict(default=[], type='list'), - zone=dict(default=""), + zone=dict(), wait=dict(default=True, type='bool'), hard_modify=dict(type='bool') ))