Skip to content
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

[Bug]: Auto scaling instance refresh fails with validation errors #33377

Closed
mhowell-ims opened this issue Sep 8, 2023 · 8 comments · Fixed by #33382
Closed

[Bug]: Auto scaling instance refresh fails with validation errors #33377

mhowell-ims opened this issue Sep 8, 2023 · 8 comments · Fixed by #33382
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Milestone

Comments

@mhowell-ims
Copy link

mhowell-ims commented Sep 8, 2023

Terraform Core Version

1.4.6

AWS Provider Version

5.16.0

Affected Resource(s)

aws_autoscaling_group

Expected Behavior

The instance refresh should not have failed due to validation errors. No values were provided for instance_refresh.preferences.scale_in_protected_instances nor for instance_refresh.preferences.standby_instances, and therefor the documented default values should have been used.

Actual Behavior

Auto scaling instance refreshes are failing since upgrading from AWS provider 5.15.0 to 5.16.0. Instance refreshes are now failing with:

Error: starting Auto Scaling Group (nexus-20230829195735457800000001) instance refresh: 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]

No values were set for either of these preferences in the terraform configuration and so the documented default values should have been used.

Relevant Error/Panic Output Snippet

Error: starting Auto Scaling Group (nexus-20230829195735457800000001) instance refresh: 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]

Terraform Configuration Files

aws-provider-bug-33377.tar.gz

Steps to Reproduce

  1. Run terraform init and terraform apply.
  2. Wait for the auto scaling group to create the 1 EC2 instance.
  3. Edit line 40 of instance-init.sh to echo a different value.
  4. Run terraform apply again. The change to the userdata script will trigger a change to the launch template and therefor an instance refresh as well.
  5. The terraform apply should succeed as we are using AWS provider v 5.15.0 at this point.
  6. Wait for the instance refresh to complete.
  7. Edit versions.tf to change the AWS provider version to 5.16.0.
  8. Repeat steps 3 and 4 above.
  9. terraform apply reports 2 instance refresh validation errors, and no instance refresh is performed.

Debug Output

No response

Panic Output

No response

Important Factoids

I am using terraform-aws-modules/autoscaling/aws version 6.10.0 (latest as of now) to create the auto scaling group. Based on the code you can see that it's using a dynamic block to the build the instance refresh configuration. No values are provided for instance_refresh.preferences.scale_in_protected_instances nor for instance_refresh.preferences.standby_instances. https://github.com/terraform-aws-modules/terraform-aws-autoscaling/blob/v6.10.0/main.tf#L669

References

No response

Would you like to implement a fix?

None

@mhowell-ims mhowell-ims added the bug Addresses a defect in current functionality. label Sep 8, 2023
@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 8, 2023
@mhowell-ims
Copy link
Author

aws-provider-bug-33377.tar.gz

Here is the terraform code to reproduce the issue.

@adiospeds
Copy link
Contributor

adiospeds commented Sep 8, 2023

I have traced this to changes made in v5.16.1 because of #33310 and I have created a Pull request to fix this issue: #33382

Please upvote the fix #33382 so it gets attention and gets merged as soon as possible.

@zm-alex
Copy link

zm-alex commented Sep 8, 2023

+1 on this issue

This is a blocker for anyone using the aws-autoscaling-group module and instance refresh resources

@shb-mll
Copy link

shb-mll commented Sep 8, 2023

+1 on this issue.

@Nikhilpurva
Copy link

Instance refresh will work if you add scale_in_protected_instances in your instance refresh config. For eg:

instance_refresh = {
    strategy = "Rolling"
    preferences = {
      min_healthy_percentage = 50
      instance_warmup        = 0
      scale_in_protected_instances = "Ignore"
    }
    triggers = ["launch_template"]
  }

@ewbankkit ewbankkit added service/autoscaling Issues and PRs that pertain to the autoscaling service. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 11, 2023
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 11, 2023
@github-actions github-actions bot added this to the v5.17.0 milestone Sep 11, 2023
@YakDriver YakDriver modified the milestones: v5.17.0, v5.16.2 Sep 11, 2023
@github-actions github-actions bot removed the bug Addresses a defect in current functionality. label Sep 11, 2023
@github-actions
Copy link

This functionality has been released in v5.16.2 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2023
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/autoscaling Issues and PRs that pertain to the autoscaling service.
Projects
None yet
8 participants