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
- The project has the full apply in the README.md
- A sort of work around I found is in the “Problem Matrix” here.
- ASG here: https://github.com/tolson-vkn/why-asg-no-work/blob/master/mod/asg.tf#L152-L215
Thanks, happy to assist in anyway.