Fail in ec2 if exact_count is specified without using count_tag

Fixes ansible/ansible#9431
pull/18777/head
James Cammarata 10 years ago committed by Matt Clay
parent dfd4433fba
commit bb9433f198

@ -660,6 +660,11 @@ def enforce_count(module, ec2):
count_tag = module.params.get('count_tag') count_tag = module.params.get('count_tag')
zone = module.params.get('zone') zone = module.params.get('zone')
# fail here if the exact count was specified without filtering
# on a tag, as this may lead to a undesired removal of instances
if exact_count and count_tag is None:
module.fail_json(msg="you must use the 'count_tag' option with exact_count")
reservations, instances = find_running_instances_by_count_tag(module, ec2, count_tag, zone) reservations, instances = find_running_instances_by_count_tag(module, ec2, count_tag, zone)
changed = None changed = None

Loading…
Cancel
Save