Merge pull request #2735 from noqcks/no-default-sec-groups

Elasticache Module: changing default cache_security_group to none
This commit is contained in:
James Cammarata 2016-02-07 21:43:35 -05:00
commit e2f8ed1609

View file

@ -43,7 +43,7 @@ options:
description: description:
- The version number of the cache engine - The version number of the cache engine
required: false required: false
default: none default: None
node_type: node_type:
description: description:
- The compute and memory capacity of the nodes in the cache cluster - The compute and memory capacity of the nodes in the cache cluster
@ -57,7 +57,7 @@ options:
description: description:
- The port number on which each of the cache nodes will accept connections - The port number on which each of the cache nodes will accept connections
required: false required: false
default: none default: None
cache_parameter_group: cache_parameter_group:
description: description:
- The name of the cache parameter group to associate with this cache cluster. If this argument is omitted, the default cache parameter group for the specified engine will be used. - The name of the cache parameter group to associate with this cache cluster. If this argument is omitted, the default cache parameter group for the specified engine will be used.
@ -75,13 +75,13 @@ options:
description: description:
- A list of vpc security group names to associate with this cache cluster. Only use if inside a vpc - A list of vpc security group names to associate with this cache cluster. Only use if inside a vpc
required: false required: false
default: ['default'] default: None
version_added: "1.6" version_added: "1.6"
cache_security_groups: cache_security_groups:
description: description:
- A list of cache security group names to associate with this cache cluster. Must be an empty list if inside a vpc - A list of cache security group names to associate with this cache cluster. Must be an empty list if inside a vpc
required: false required: false
default: ['default'] default: None
zone: zone:
description: description:
- The EC2 Availability Zone in which the cache cluster will be created - The EC2 Availability Zone in which the cache cluster will be created
@ -477,14 +477,12 @@ class ElastiCacheManager(object):
return cache_node_ids[-num_nodes_to_remove:] return cache_node_ids[-num_nodes_to_remove:]
def main(): def main():
argument_spec = ec2_argument_spec() argument_spec = ec2_argument_spec()
default = object()
argument_spec.update(dict( argument_spec.update(dict(
state ={'required': True, 'choices': ['present', 'absent', 'rebooted']}, state ={'required': True, 'choices': ['present', 'absent', 'rebooted']},
name ={'required': True}, name ={'required': True},
engine={'required': False, 'choices': ['redis', 'memcached'], 'default': 'memcached'}, engine ={'required': False, 'default': 'memcached'},
cache_engine_version ={'required': False}, cache_engine_version ={'required': False},
node_type ={'required': False, 'default': 'cache.m1.small'}, node_type ={'required': False, 'default': 'cache.m1.small'},
num_nodes ={'required': False, 'default': None, 'type': 'int'}, num_nodes ={'required': False, 'default': None, 'type': 'int'},
@ -492,10 +490,8 @@ def main():
cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']}, cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']},
cache_port ={'required': False, 'type': 'int'}, cache_port ={'required': False, 'type': 'int'},
cache_subnet_group ={'required': False, 'default': None}, cache_subnet_group ={'required': False, 'default': None},
cache_security_groups={'required': False, 'default': [default], cache_security_groups ={'required': False, 'default': [], 'type': 'list'},
'type': 'list'}, security_group_ids ={'required': False, 'default': [], 'type': 'list'},
security_group_ids={'required': False, 'default': [],
'type': 'list'},
zone ={'required': False, 'default': None}, zone ={'required': False, 'default': None},
wait ={'required': False, 'type' : 'bool', 'default': True}, wait ={'required': False, 'type' : 'bool', 'default': True},
hard_modify ={'required': False, 'type': 'bool', 'default': False} hard_modify ={'required': False, 'type': 'bool', 'default': False}
@ -526,14 +522,9 @@ def main():
hard_modify = module.params['hard_modify'] hard_modify = module.params['hard_modify']
cache_parameter_group = module.params['cache_parameter_group'] cache_parameter_group = module.params['cache_parameter_group']
if cache_subnet_group and cache_security_groups == [default]:
cache_security_groups = []
if cache_subnet_group and 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") 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: if state == 'present' and not num_nodes:
module.fail_json(msg="'num_nodes' is a required parameter. Please specify num_nodes > 0") module.fail_json(msg="'num_nodes' is a required parameter. Please specify num_nodes > 0")