-
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
r/aws_autoscaling_group: disable scale-in protection before draining instances #23187
r/aws_autoscaling_group: disable scale-in protection before draining instances #23187
Conversation
…otection for all instances
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 PKG=autoscaling TESTS=TestAccAutoScalingGroup_ ACCTEST_PARALLELISM=4
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/autoscaling/... -v -count 1 -parallel 4 -run='TestAccAutoScalingGroup_' -timeout 180m
=== RUN TestAccAutoScalingGroup_basic
=== PAUSE TestAccAutoScalingGroup_basic
=== RUN TestAccAutoScalingGroup_Name_generated
=== PAUSE TestAccAutoScalingGroup_Name_generated
=== RUN TestAccAutoScalingGroup_namePrefix
=== PAUSE TestAccAutoScalingGroup_namePrefix
=== RUN TestAccAutoScalingGroup_terminationPolicies
=== PAUSE TestAccAutoScalingGroup_terminationPolicies
=== RUN TestAccAutoScalingGroup_tags
=== PAUSE TestAccAutoScalingGroup_tags
=== RUN TestAccAutoScalingGroup_vpcUpdates
=== PAUSE TestAccAutoScalingGroup_vpcUpdates
=== RUN TestAccAutoScalingGroup_withLoadBalancer
=== PAUSE TestAccAutoScalingGroup_withLoadBalancer
=== RUN TestAccAutoScalingGroup_WithLoadBalancer_toTargetGroup
=== PAUSE TestAccAutoScalingGroup_WithLoadBalancer_toTargetGroup
=== RUN TestAccAutoScalingGroup_withPlacementGroup
=== PAUSE TestAccAutoScalingGroup_withPlacementGroup
=== RUN TestAccAutoScalingGroup_enablingMetrics
=== PAUSE TestAccAutoScalingGroup_enablingMetrics
=== RUN TestAccAutoScalingGroup_suspendingProcesses
=== PAUSE TestAccAutoScalingGroup_suspendingProcesses
=== RUN TestAccAutoScalingGroup_withMetrics
=== PAUSE TestAccAutoScalingGroup_withMetrics
=== RUN TestAccAutoScalingGroup_serviceLinkedRoleARN
=== PAUSE TestAccAutoScalingGroup_serviceLinkedRoleARN
=== RUN TestAccAutoScalingGroup_maxInstanceLifetime
=== PAUSE TestAccAutoScalingGroup_maxInstanceLifetime
=== RUN TestAccAutoScalingGroup_ALB_targetGroups
=== PAUSE TestAccAutoScalingGroup_ALB_targetGroups
=== RUN TestAccAutoScalingGroup_targetGroupARNs
=== PAUSE TestAccAutoScalingGroup_targetGroupARNs
=== RUN TestAccAutoScalingGroup_initialLifecycleHook
=== PAUSE TestAccAutoScalingGroup_initialLifecycleHook
=== RUN TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity
=== PAUSE TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity
=== RUN TestAccAutoScalingGroup_InstanceRefresh_basic
=== PAUSE TestAccAutoScalingGroup_InstanceRefresh_basic
=== RUN TestAccAutoScalingGroup_InstanceRefresh_start
=== PAUSE TestAccAutoScalingGroup_InstanceRefresh_start
=== RUN TestAccAutoScalingGroup_InstanceRefresh_triggers
=== PAUSE TestAccAutoScalingGroup_InstanceRefresh_triggers
=== RUN TestAccAutoScalingGroup_warmPool
=== PAUSE TestAccAutoScalingGroup_warmPool
=== RUN TestAccAutoScalingGroup_classicVPCZoneIdentifier
=== PAUSE TestAccAutoScalingGroup_classicVPCZoneIdentifier
=== RUN TestAccAutoScalingGroup_launchTemplate
=== PAUSE TestAccAutoScalingGroup_launchTemplate
=== RUN TestAccAutoScalingGroup_LaunchTemplate_update
=== PAUSE TestAccAutoScalingGroup_LaunchTemplate_update
=== RUN TestAccAutoScalingGroup_LaunchTemplate_iamInstanceProfile
=== PAUSE TestAccAutoScalingGroup_LaunchTemplate_iamInstanceProfile
=== RUN TestAccAutoScalingGroup_loadBalancers
=== PAUSE TestAccAutoScalingGroup_loadBalancers
=== RUN TestAccAutoScalingGroup_mixedInstancesPolicy
=== PAUSE TestAccAutoScalingGroup_mixedInstancesPolicy
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicy_capacityRebalance
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicy_capacityRebalance
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandAllocationStrategy
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandAllocationStrategy
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandBaseCapacity
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandBaseCapacity
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_updateToZeroOnDemandBaseCapacity
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_updateToZeroOnDemandBaseCapacity
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandPercentageAboveBaseCapacity
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandPercentageAboveBaseCapacity
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotAllocationStrategy
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotAllocationStrategy
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotInstancePools
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotInstancePools
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotMaxPrice
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotMaxPrice
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_launchTemplateName
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_launchTemplateName
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_version
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_version
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceType
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceType
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceTypeWithLaunchTemplateSpecification
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceTypeWithLaunchTemplateSpecification
=== RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity
=== PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity
=== RUN TestAccAutoScalingGroup_launchTempPartitionNum
=== PAUSE TestAccAutoScalingGroup_launchTempPartitionNum
=== RUN TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn
=== PAUSE TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn
=== CONT TestAccAutoScalingGroup_basic
=== CONT TestAccAutoScalingGroup_classicVPCZoneIdentifier
=== CONT TestAccAutoScalingGroup_withMetrics
=== CONT TestAccAutoScalingGroup_warmPool
--- PASS: TestAccAutoScalingGroup_classicVPCZoneIdentifier (59.62s)
=== CONT TestAccAutoScalingGroup_InstanceRefresh_triggers
--- PASS: TestAccAutoScalingGroup_withMetrics (95.54s)
=== CONT TestAccAutoScalingGroup_InstanceRefresh_start
--- PASS: TestAccAutoScalingGroup_InstanceRefresh_triggers (213.57s)
=== CONT TestAccAutoScalingGroup_InstanceRefresh_basic
--- PASS: TestAccAutoScalingGroup_warmPool (286.81s)
=== CONT TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity
--- PASS: TestAccAutoScalingGroup_basic (315.15s)
=== CONT TestAccAutoScalingGroup_initialLifecycleHook
--- PASS: TestAccAutoScalingGroup_InstanceRefresh_start (267.44s)
=== CONT TestAccAutoScalingGroup_targetGroupARNs
--- PASS: TestAccAutoScalingGroup_initialLifecycleHook (237.21s)
=== CONT TestAccAutoScalingGroup_ALB_targetGroups
--- PASS: TestAccAutoScalingGroup_InstanceRefresh_basic (296.73s)
=== CONT TestAccAutoScalingGroup_maxInstanceLifetime
--- PASS: TestAccAutoScalingGroup_targetGroupARNs (209.46s)
=== CONT TestAccAutoScalingGroup_serviceLinkedRoleARN
--- PASS: TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity (340.48s)
=== CONT TestAccAutoScalingGroup_terminationPolicies
--- PASS: TestAccAutoScalingGroup_serviceLinkedRoleARN (62.33s)
=== CONT TestAccAutoScalingGroup_vpcUpdates
--- PASS: TestAccAutoScalingGroup_maxInstanceLifetime (99.54s)
=== CONT TestAccAutoScalingGroup_tags
--- PASS: TestAccAutoScalingGroup_ALB_targetGroups (163.33s)
=== CONT TestAccAutoScalingGroup_enablingMetrics
--- PASS: TestAccAutoScalingGroup_vpcUpdates (95.74s)
=== CONT TestAccAutoScalingGroup_withLoadBalancer
--- PASS: TestAccAutoScalingGroup_terminationPolicies (178.28s)
=== CONT TestAccAutoScalingGroup_withPlacementGroup
--- PASS: TestAccAutoScalingGroup_enablingMetrics (194.94s)
=== CONT TestAccAutoScalingGroup_suspendingProcesses
--- PASS: TestAccAutoScalingGroup_withPlacementGroup (125.37s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotAllocationStrategy
--- PASS: TestAccAutoScalingGroup_tags (274.82s)
=== CONT TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotAllocationStrategy (53.52s)
=== CONT TestAccAutoScalingGroup_launchTempPartitionNum
--- PASS: TestAccAutoScalingGroup_launchTempPartitionNum (62.23s)
=== CONT TestAccAutoScalingGroup_WithLoadBalancer_toTargetGroup
--- PASS: TestAccAutoScalingGroup_withLoadBalancer (413.15s)
=== CONT TestAccAutoScalingGroup_namePrefix
--- PASS: TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn (203.70s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity
--- PASS: TestAccAutoScalingGroup_suspendingProcesses (287.58s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_version
--- PASS: TestAccAutoScalingGroup_namePrefix (63.78s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceTypeWithLaunchTemplateSpecification
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceTypeWithLaunchTemplateSpecification (72.00s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceType
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_version (101.84s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_launchTemplateName
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity (157.75s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotInstancePools
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_launchTemplateName (67.67s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotMaxPrice
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceType (111.17s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicy_capacityRebalance
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotInstancePools (118.43s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandPercentageAboveBaseCapacity
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicy_capacityRebalance (62.07s)
=== CONT TestAccAutoScalingGroup_Name_generated
--- PASS: TestAccAutoScalingGroup_Name_generated (55.45s)
=== CONT TestAccAutoScalingGroup_mixedInstancesPolicy
--- PASS: TestAccAutoScalingGroup_WithLoadBalancer_toTargetGroup (462.20s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandBaseCapacity
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandPercentageAboveBaseCapacity (102.64s)
=== CONT TestAccAutoScalingGroup_LaunchTemplate_update
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotMaxPrice (165.59s)
=== CONT TestAccAutoScalingGroup_LaunchTemplate_iamInstanceProfile
--- PASS: TestAccAutoScalingGroup_mixedInstancesPolicy (73.54s)
=== CONT TestAccAutoScalingGroup_loadBalancers
--- PASS: TestAccAutoScalingGroup_LaunchTemplate_iamInstanceProfile (80.33s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandAllocationStrategy
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandBaseCapacity (152.64s)
=== CONT TestAccAutoScalingGroup_launchTemplate
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandAllocationStrategy (60.40s)
=== CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_updateToZeroOnDemandBaseCapacity
--- PASS: TestAccAutoScalingGroup_launchTemplate (62.72s)
--- PASS: TestAccAutoScalingGroup_LaunchTemplate_update (228.79s)
--- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_updateToZeroOnDemandBaseCapacity (107.42s)
--- PASS: TestAccAutoScalingGroup_loadBalancers (369.03s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling 1954.624s
@roberth-k Thanks for the contribution 🎉 👏. |
This functionality has been released in v4.1.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. |
Community Note
Closes #5278
Before draining instances during a destroy, switch off scale-in protection of all instances in the ASG. This is necessary as the resource chooses to reduce desired (and actual) instance count to 0 before destroying the ASG.
This behaviour shouldn't be a semantic concession, as deleting the ASG in the console would still result in the termination of the protected instances. Scale-in protection is a property of an instance's association with the ASG, and retaining the instances whilst destroying the ASG would necessitate detaching them from the ASG anyway.
Output from acceptance testing: