-
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 defaults desired_capacity to zero with no way of specifying an empty value #5681
Comments
Hey @daveadams – thanks for opening this. I also opened #5694 to push this along, as we're in a bit of a tough spot here, needing to both omit and allow zero values. |
Great. Yeah I figured it had something to do with that. |
Can you make -1 equivalent to omit behind the scenes? This could be useful for making other generic modules where I want to reuse the module but not every key. Even better would be to allow a null or nil or some other non-magic number token for specific resource keys that allow it. |
@daveadams similar to what ^ said, I'd like to apply changes to the infra without resetting desired capacity to a fixed number (because we autoscale outside terraform). Omitting the value sets it to the min right now (I think?). Is there a way to apply changes without changing the current value for desired capacity? |
Same thing here: We just want to change min value by schedule, but the desired (and max) value should be kept. Terraform raises: "Error Creating Autoscaling Scheduled Action: ValidationError: Desired capacity must be less than or equal to max size" |
Specifically, this allows you to create a schedule which only changes some of the group parameters without changing others, by setting the parameters you wish to remain empty to -1. This means you can adjust min or max size without affecting the desired capacity, for example. The ad hoc support for -1 isn't as nice as having real support for leaving values out (see hashicorp#5694) but it solves a real use case. Fixes hashicorp#5681.
Specifically, this allows you to create a schedule which only changes some of the group parameters without changing others, by setting the parameters you wish to remain empty to -1. This means you can adjust min or max size without affecting the desired capacity, for example. The ad hoc support for -1 isn't as nice as having real support for leaving values out (see hashicorp#5694) but it solves a real use case. Fixes hashicorp#5681.
Here's a PR to fix it using the ghost's suggestion. #9941 |
Specifically, this allows you to create a schedule which only changes some of the group parameters without changing others, by setting the parameters you wish to remain empty to -1. This means you can adjust min or max size without affecting the desired capacity, for example. The ad hoc support for -1 isn't as nice as having real support for leaving values out (see hashicorp#5694) but it solves a real use case. Fixes hashicorp#5681.
Setting desired, min and max all to "1" fails with
|
Any update? I've just created scheduled action and have to specify min_size and max_size while I just want to change desired_capicity :-( |
#9941 still works for us. I'd love to see it merged! |
This is an active blocker for us. Would love to see #9941 get reviewed/merged. |
This is also a blocker for us, another bump to #9941 :) |
Specifically, this allows you to create a schedule which only changes some of the group parameters without changing others, by setting the parameters you wish to remain empty to -1. This means you can adjust min or max size without affecting the desired capacity, for example. The ad hoc support for -1 isn't as nice as having real support for leaving values out (see hashicorp#5694) but it solves a real use case. Fixes hashicorp#5681.
👍 |
Just found this in the docs for those who found this issue:
Seems like the desired behavior can be triggered by manually setting them to -1. @catsby: Is there a reason why the default is 0 and not -1? I would normally expect that not setting optional values means to not change them at the scheduled time rather than setting them to 0. |
I implemented the PR that got merged (though somebody else ported it to a new repo). My memory was, at least at that time, Terraform couldn't usefully differentiate between "parameter given as 0" and "parameter left blank". |
That is a side-effect of the Go serialization I think, but there are ways to check for empty vs literal zero, and other AWS provider resources handle this sort of situation just fine, also this used to work, long ago... |
This issue has been automatically migrated to hashicorp/terraform-provider-aws#6379 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#6379. |
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. |
Thanks to #4690 we are no longer able to make use of aws_autoscaling_schedule resources. With a config like:
We get an error (via Terraform, from the AWS API) that "desired_capacity cannot be less than min_size". But we wish for desired_capacity to be managed by the autoscaling group, not by Terraform, and so we cannot specify a desired capacity. There should be a way to indicate that we do not wish for anything to be specified for desired_capacity.
The text was updated successfully, but these errors were encountered: