Make cache_subnet_group default to empty security groups

Since they can't be specified together, it seems like setting the
default to no security groups is the right option.
reviewable/pr18780/r1
Brandon W Maister 10 years ago
parent 3cb2346312
commit efa4d04284

@ -485,6 +485,7 @@ class ElastiCacheManager(object):
def main():
argument_spec = ec2_argument_spec()
default = object()
argument_spec.update(dict(
state={'required': True, 'choices': ['present', 'absent', 'rebooted']},
name={'required': True},
@ -494,7 +495,7 @@ def main():
num_nodes={'required': False, 'default': None, 'type': 'int'},
cache_port={'required': False, 'default': 11211, 'type': 'int'},
cache_subnet_group={'required': False, 'default': None},
cache_security_groups={'required': False, 'default': ['default'],
cache_security_groups={'required': False, 'default': [default],
'type': 'list'},
security_group_ids={'required': False, 'default': [],
'type': 'list'},
@ -524,6 +525,14 @@ def main():
wait = module.params['wait']
hard_modify = module.params['hard_modify']
if cache_subnet_group and cache_security_groups == [default]:
cache_security_groups = []
if cache_subnet_group and cache_security_groups:
module.fail_json(msg="Can't specify both cache_subnet_group and cache_security_groups")
if cache_security_groups == [default]:
cache_security_groups = ['default']
if state == 'present' and not num_nodes:
module.fail_json(msg="'num_nodes' is a required parameter. Please specify num_nodes > 0")

Loading…
Cancel
Save