terraform-aws-modules / terraform-aws-autoscaling

Terraform module to create AWS Auto Scaling resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws
Apache License 2.0
288 stars 552 forks source link

fix: Added all instance refresh options, including scale in protection and standby instances #243

Closed mickmorse closed 10 months ago

mickmorse commented 10 months ago

Description

Not all preferences were available in the instance_refresh map. I've added the rest of them in.

Motivation and Context

I was getting the below error when using the module:

ValidationError: 2 validation errors detected: Value '' at 'preferences.scaleInProtectedInstances' failed to satisfy constraint: Member must satisfy enum value set: [Ignore, Wait, Refresh]; Value '' at 'preferences.standbyInstances' failed to satisfy constraint: Member must satisfy enum value set: [Terminate, Ignore, Wait]

Breaking Changes

Since all parameters are optional. There are no breaking changes

How Has This Been Tested?

jseiser commented 10 months ago

We are also hitting this error now.

I assume the issue is coming in from the new AWS provider: https://github.com/hashicorp/terraform-provider-aws/issues/33310

adiospeds commented 10 months ago

Thanks for the PR - We hit the same issue:

Value '' at 'preferences.scaleInProtectedInstances' failed to satisfy constraint: Member must satisfy enum value set: [Ignore, Wait, Refresh]; 
Value '' at 'preferences.standbyInstances' failed to satisfy constraint: Member must satisfy enum value set: [Terminate, Ignore, Wait]

One thing I'd like to bring to notice is the documentation for scale_in_protected_instances and standby_instances says Default values as Wait, so those should also get Updated if this PR is approved, or set the value in this PR from Ignore to Wait

bryantbiggs commented 10 months ago

Please open an issue on the AWS provider - this sounds like a bug for the provider

mhowell-ims commented 10 months ago

I've opened https://github.com/hashicorp/terraform-provider-aws/issues/33377 .

You can avoid this bug by downgrading your AWS provider to 5.15.0.

mhowell-ims commented 10 months ago

There is already a PR for the bug in the AWS provider. Consider upvoting it. https://github.com/hashicorp/terraform-provider-aws/pull/33382

mickmorse commented 10 months ago

Thanks for the PR - We hit the same issue:

Value '' at 'preferences.scaleInProtectedInstances' failed to satisfy constraint: Member must satisfy enum value set: [Ignore, Wait, Refresh]; 
Value '' at 'preferences.standbyInstances' failed to satisfy constraint: Member must satisfy enum value set: [Terminate, Ignore, Wait]

One thing I'd like to bring to notice is the documentation for scale_in_protected_instances and standby_instances says Default values as Wait, so those should also get Updated if this PR is approved, or set the value in this PR from Ignore to Wait

This is done. Thanks for your input.

bryantbiggs commented 10 months ago

this should be resolved now with https://github.com/hashicorp/terraform-provider-aws/releases/tag/v5.16.2

mickmorse commented 10 months ago

this should be resolved now with https://github.com/hashicorp/terraform-provider-aws/releases/tag/v5.16.2

Well no because not all options are available in the instance refresh block. This PR was to make them available regardless of the bug.

bryantbiggs commented 10 months ago

that will require v5.x of the AWS provider and therefore a breaking change - this will be handled in #240

github-actions[bot] commented 9 months ago

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.