Cannot create ASG with mixed_instances and lifecycle hooks

Hello All,

I’m running into an issue with mixed_instances ASGs and some initial_lifecycle_hook within.

Error: Error creating AutoScaling Group: ValidationError: Max bound, 0, must be greater than or equal to OnDemandBaseCapacity, 1.
        status code: 400, request id: XXX

(tf v0.13.0, aws provider 3.2.0)

I have some EKS node ASGs that use life cycle hooks to send termination, something running in kube subscribes and drains the nodes. So it’s pretty important that these hooks are part of initial ASG. FWIW I ran into problems using the aws_autoscaling_lifecycle_hook and my count resources that exist on ASG, SQS queue name etc.

We run these ASGs with some ondemand base and the rest of the instances are spot. For some reason it will not work with initial_lifecycle_hooks and ondemand base. I can only run the terraform apply if I have 0 ondemand base.

I’ve created a sample project that has all of the kube (and unnecessary stuff) taken out. It should be 1 ondemand and 1 spot. But using any base ondemand + initial_lifecycle_hook causes the 400 error.

Here is the project: https://github.com/tolson-vkn/why-asg-no-work

Thanks, happy to assist in anyway.
Tim