-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Protect instance from autoscale in on aws_autoscaling_group #6490
Protect instance from autoscale in on aws_autoscaling_group #6490
Conversation
@@ -304,6 +312,8 @@ func resourceAwsAutoscalingGroupUpdate(d *schema.ResourceData, meta interface{}) | |||
AutoScalingGroupName: aws.String(d.Id()), | |||
} | |||
|
|||
opts.NewInstancesProtectedFromScaleIn = aws.Bool(d.Get("protect_from_scale_in").(bool)) |
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.
I attempted to use the following:
if d.HasChange("protect_from_scale_in") {
opts.NewInstancesProtectedFromScaleIn = aws.Bool(d.Get("protect_from_scale_in").(bool))
}
However, I found that the state was never updated. My expectation is that HasChange
should be used, not yet clear why I was unable to complete updates when using HasChange
.
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.
This is indeed the correct way of updating - otherwise we will be passing an unnecessary parameter to the API each time
I was able to use the same code you had and it updated as expected.
Hi @jwieringa My apologies for this sliding through the cracks. So I have just tested this with a few changes and it works. Comments inline :) Paul |
In the test:
by default, this will be so we can test that as part of the acceptance test:
the test then pushes through an update:
In this code, we can set
By making these changes, you will get a test result as follows:
Nice work :) |
63e9c32
to
682c8fd
Compare
682c8fd
to
b0c4c68
Compare
@stack72 Thank you! The detailed explanation on testing is appreciated. Rebased on master. Updated with tests. Removed WIP title.
@stack72 Please let me know if there is anything else I can do. |
Hi @jwieringa This looks really good now :) Test results are as expected - nice work! Merging!
Paul |
@stack72 Thank you! |
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. |
Desired functionality: Ability to set Instance Protection to "Protect From Scale In" on an AWS auto scaling group.
I understand this change to be working through manual testing. I'm opening the PR for discussion and feedback.
Please let me know if there are any questions - Thanks!