-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_autoscaling_schedule - cannot set zero to max/min/desired #4690
Comments
Oh, I should note - I did attempt to use zero values through the AWS CLI manually, and it does fully accept a scheduled scaling action that sets min/desired to zero, which is the effect we're looking for. |
@AirbornePorcine please can you post a short snippet of your terraform config that I can use as an acceptance test to fix this bug? (Remember to remove secrets from the config if there are any) |
For sure.
|
thanks @AirbornePorcine, I will submit a PR to fix this shortly |
@AirbornePorcine ok, I have been able to add a test to prove this is the case. unfortunately, I believe this is actually a known bug and will need solving in Terraform core I have opened a PR with the test to show the issue to the core team #4693 |
Just wanted to leave a "me too!" note, as i was trying to shut down our integration/staging environments over night and now have 1 instance still running ;-) |
@AirbornePorcine (and @jangrewe) so a PR has just been merged that sets default values for min_size, max_size and desired_capacity to 0. This means that your 0 will now work by default :) Hope this helps! |
It does, thanks! =) |
Thanks, works for us! |
Unfortunately this "fix" broke our use case for this resource. We don't want to specify desired_capacity or max_size in our scheduled action. But thanks to the default of zero, we now get an error that desired_capacity cannot be less than min_size. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi!
So I'm attempting to create a aws_autoscaling_schedule resource that shuts down all my instances overnight. When I try to do this with terraform however, any field of max_size/min_size/desired_capacity that is set to zero is effectively ignored. If they're all set to zero, you get this error:
If I set any single field to a non-zero value, then my autoscaling schedule (via aws autoscaling describe-scheduled-action) looks like this (min/desired set to zero, max set to 2):
Looking at the code in resource_aws_autoscheduling_schedule.go, I noticed the following:
The d.GetOk call is specifically meant to not return zero values. Changing this to just Ok wouldn't work very well since then (as I understand it), not specifying a field would be equivalent to a zero value.
So, looking for a little guidance on how you'd like to resolve this, then I can submit a PR. Thanks!
The text was updated successfully, but these errors were encountered: