ec2-asg Module - AWS Autoscaling groups going over the desired instance count and then scaling back

Hello,

I’m wondering if anyone else has observed that when using this Ansible module the AWS API does the following:

1.-Sets the number of instances to be over the desired count, even the maximum if all values are 1.
2.-Rolls back the number of instances.

This of course turns into having to pay for one hour of instances that are immediately terminated.

In the example below the desired capacity is less than the maximum still, the asg goes over the desired capacity when it is instantiated using this module:

Code:

`

  • name: create autoscale groups
    ec2_asg:
    name: my_asg
    load_balancers: my_elb
    launch_config_name: my_lc
    min_size: 1
    max_size: 8
    desired_capacity: 2
    region: us-west-1
    vpc_zone_identifier: subnet-090909
    health_check_type: EC2
    replace_all_instances: yes
    replace_batch_size: '1
    lc_check: false
    default_cooldown: 1200
    health_check_period: 1200

`

Hi, can you attach your Ansible and modules version? I believe there were some changes to this behavior released with 2.1, so upgrading may solve your problem.

Thanks,
Ryan