Fail gracefully in ec2_asg module when there are no matching launch configurations

This commit is contained in:
Ryan S. Brown 2016-11-10 08:51:51 -05:00 committed by Matt Clay
parent 06e1141106
commit 5dd9372ff8

View file

@ -442,6 +442,8 @@ def create_autoscaling_group(connection, module):
availability_zones = module.params['availability_zones'] = [zone.name for zone in ec2_connection.get_all_zones()]
enforce_required_arguments(module)
launch_configs = connection.get_all_launch_configurations(names=[launch_config_name])
if len(launch_configs) == 0:
module.fail_json(msg="No launch config found with name %s" % launch_config_name)
ag = AutoScalingGroup(
group_name=group_name,
load_balancers=load_balancers,