-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Fix] Set instance protection can fail as instance can be already deleted from Autoscaling Group #35071
[Fix] Set instance protection can fail as instance can be already deleted from Autoscaling Group #35071
Conversation
Community NoteVoting for Prioritization
For Submitters
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @MTB90 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
…h 'acctest.ConfigLatestAmazonLinux2HVMEBSX8664AMI()'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
% make testacc TESTARGS='-run=TestAccAutoScalingGroup_Destroy\|TestAccAutoScalingGroup_basic' PKG=autoscaling ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/autoscaling/... -v -count 1 -parallel 2 -run=TestAccAutoScalingGroup_Destroy\|TestAccAutoScalingGroup_basic -timeout 360m
=== RUN TestAccAutoScalingGroup_basic
=== PAUSE TestAccAutoScalingGroup_basic
=== RUN TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn
=== PAUSE TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn
=== CONT TestAccAutoScalingGroup_basic
=== CONT TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn
--- PASS: TestAccAutoScalingGroup_basic (50.53s)
--- PASS: TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn (165.53s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling 171.230s
@MTB90 Thanks for the contribution 🎉 👏. |
This functionality has been released in v5.32.0 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! |
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. |
Description
Set instance protection can fail when instance, will be already removed from autoscaling group.
Method
drainGroup
is first updating AutoScalingGroup with{DesiredCapacity: 0, MinSize:0, MaxSize: 0}
next ensure that instances are not prevented from scaling in, as make sens updating autoscaling group as soon as posible.
Is posible that
SetInstanceProtectionWithContext
will fail, this can happen at least in two cases:API will be throttled for few sec by other client calls, but when throttling ends instance can be already fully removed
so then
SetInstanceProtectionWithContext
return ValidationErrorThe number of instances in autoscaling group is large, there will be multiple requests to run
SetInstanceProtectionWithContext
as they are run with package of 50 instances there is posibility that in the one of this package there will be instance that will be already removed from ASGI faced that issue when I run multiple terraforms at the same time, and dude AWS API throtlled limits
I got this error:
Imo if instance is already fully removed, fail in disabling scale-in protections should not fail terraform destroy
also depends on if there is one instance or more instances that are not a part of autoscaling group any more the error contain:
The instance <instance> is not part of Auto Scaling group ...
or
The instances <instance>, <instance> are not part of Auto Scaling group ...
Output from Acceptance Testing