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

resource/aws_autoscaling_group: Add Instance Refresh configuration #16678

Merged
merged 14 commits into from
Dec 18, 2020

Conversation

gdavison
Copy link
Contributor

@gdavison gdavison commented Dec 9, 2020

Adds Instance Refresh configuration to Auto Scaling Groups. Builds on work done by @roberth-k in #13791 and #14442.

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #13785
Relates #13791
Closes #14442

Release note for CHANGELOG:

* resource/aws_autoscaling_group: Adds Instance Refresh configuration

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSAutoScalingGroup_'

--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandAllocationStrategy (694.24s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate (697.56s)
--- PASS: TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier (708.13s)
--- PASS: TestAccAWSAutoScalingGroup_LaunchTemplate_IAMInstanceProfile (717.27s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy (722.67s)
--- PASS: TestAccAWSAutoScalingGroup_launchTempPartitionNum (729.06s)
--- PASS: TestAccAWSAutoScalingGroup_initialLifecycleHook (887.58s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (933.99s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Triggers (1117.95s)
--- PASS: TestAccAWSAutoScalingGroup_MaxInstanceLifetime (1137.47s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_UpdateToZeroOnDemandBaseCapacity (1291.08s)
--- PASS: TestAccAWSAutoScalingGroup_basic (1291.31s)
--- PASS: TestAccAWSAutoScalingGroup_serviceLinkedRoleARN (724.73s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_LaunchTemplateName (712.75s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Start (1474.75s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandBaseCapacity (1511.89s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (1538.80s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotAllocationStrategy (666.84s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_WeightedCapacity (838.13s)
--- PASS: TestAccAWSAutoScalingGroup_TargetGroupArns (1571.84s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Basic (1594.76s)
--- PASS: TestAccAWSAutoScalingGroup_suspendingProcesses (1618.22s)
--- PASS: TestAccAWSAutoScalingGroup_withMetrics (1023.05s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType (1007.31s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_Version (1013.30s)
--- PASS: TestAccAWSAutoScalingGroup_LoadBalancers (1747.06s)
--- PASS: TestAccAWSAutoScalingGroup_withPlacementGroup (610.49s)
--- PASS: TestAccAWSAutoScalingGroup_VpcUpdates (799.09s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotInstancePools (784.40s)
--- PASS: TestAccAWSAutoScalingGroup_autoGeneratedName (402.78s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate_update (1945.26s)
--- PASS: TestAccAWSAutoScalingGroup_namePrefix (397.10s)
--- PASS: TestAccAWSAutoScalingGroup_enablingMetrics (687.12s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotMaxPrice (1053.95s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandPercentageAboveBaseCapacity (592.98s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer (524.17s)
--- PASS: TestAccAWSAutoScalingGroup_terminationPolicies (633.65s)
--- PASS: TestAccAWSAutoScalingGroup_tags (641.27s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer_ToTargetGroup (817.82s)

@gdavison gdavison requested a review from a team as a code owner December 9, 2020 20:19
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/autoscaling Issues and PRs that pertain to the autoscaling service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 9, 2020
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 14, 2020
@YakDriver YakDriver self-assigned this Dec 14, 2020
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. The one big-picture design thing I wonder about (probably discussed somewhere previously) is making this a separate resource.

GovCloud acceptance tests

--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (140.39s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (294.56s)
--- PASS: TestAccAWSAutoScalingGroup_autoGeneratedName (37.50s)
--- PASS: TestAccAWSAutoScalingGroup_basic (220.73s)
--- PASS: TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier (47.64s)
--- PASS: TestAccAWSAutoScalingGroup_enablingMetrics (187.36s)
--- PASS: TestAccAWSAutoScalingGroup_initialLifecycleHook (202.92s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Basic (246.18s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Start (306.84s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Triggers (246.17s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate (45.12s)
--- PASS: TestAccAWSAutoScalingGroup_LaunchTemplate_IAMInstanceProfile (84.04s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate_update (142.32s)
--- PASS: TestAccAWSAutoScalingGroup_launchTempPartitionNum (75.58s)
--- PASS: TestAccAWSAutoScalingGroup_LoadBalancers (378.82s)
--- PASS: TestAccAWSAutoScalingGroup_MaxInstanceLifetime (84.74s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy (71.42s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_CapacityRebalance (43.13s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandAllocationStrategy (69.09s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandBaseCapacity (104.73s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandPercentageAboveBaseCapacity (79.16s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotAllocationStrategy (82.27s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotInstancePools (80.98s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotMaxPrice (98.13s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_UpdateToZeroOnDemandBaseCapacity (58.78s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_LaunchTemplateName (58.55s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_Version (71.81s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType (80.98s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_WeightedCapacity (167.82s)
--- PASS: TestAccAWSAutoScalingGroup_namePrefix (62.01s)
--- PASS: TestAccAWSAutoScalingGroup_serviceLinkedRoleARN (65.55s)
--- PASS: TestAccAWSAutoScalingGroup_suspendingProcesses (220.28s)
--- PASS: TestAccAWSAutoScalingGroup_tags (243.97s)
--- PASS: TestAccAWSAutoScalingGroup_TargetGroupArns (210.49s)
--- PASS: TestAccAWSAutoScalingGroup_terminationPolicies (121.54s)
--- PASS: TestAccAWSAutoScalingGroup_VpcUpdates (83.32s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer (321.51s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer_ToTargetGroup (524.81s)
--- PASS: TestAccAWSAutoScalingGroup_withMetrics (86.68s)
--- PASS: TestAccAWSAutoScalingGroup_withPlacementGroup (150.34s)

Commercial acceptance tests

--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (185.24s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (316.05s)
--- PASS: TestAccAWSAutoScalingGroup_autoGeneratedName (59.62s)
--- PASS: TestAccAWSAutoScalingGroup_basic (297.64s)
--- PASS: TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier (62.19s)
--- PASS: TestAccAWSAutoScalingGroup_enablingMetrics (187.17s)
--- PASS: TestAccAWSAutoScalingGroup_initialLifecycleHook (241.96s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Basic (194.20s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Start (311.48s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Triggers (220.30s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate (48.06s)
--- PASS: TestAccAWSAutoScalingGroup_LaunchTemplate_IAMInstanceProfile (85.56s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate_update (189.26s)
--- PASS: TestAccAWSAutoScalingGroup_launchTempPartitionNum (73.98s)
--- PASS: TestAccAWSAutoScalingGroup_LoadBalancers (438.74s)
--- PASS: TestAccAWSAutoScalingGroup_MaxInstanceLifetime (59.74s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy (37.40s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_CapacityRebalance (66.98s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandAllocationStrategy (38.72s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandBaseCapacity (120.54s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandPercentageAboveBaseCapacity (87.55s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotAllocationStrategy (68.28s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotInstancePools (90.50s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotMaxPrice (118.04s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_UpdateToZeroOnDemandBaseCapacity (93.71s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_LaunchTemplateName (106.26s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_Version (112.48s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType (86.53s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_WeightedCapacity (182.33s)
--- PASS: TestAccAWSAutoScalingGroup_namePrefix (59.24s)
--- PASS: TestAccAWSAutoScalingGroup_serviceLinkedRoleARN (93.20s)
--- PASS: TestAccAWSAutoScalingGroup_suspendingProcesses (219.26s)
--- PASS: TestAccAWSAutoScalingGroup_tags (253.24s)
--- PASS: TestAccAWSAutoScalingGroup_TargetGroupArns (180.20s)
--- PASS: TestAccAWSAutoScalingGroup_terminationPolicies (108.15s)
--- PASS: TestAccAWSAutoScalingGroup_VpcUpdates (92.59s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer (239.66s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer_ToTargetGroup (405.52s)
--- PASS: TestAccAWSAutoScalingGroup_withMetrics (122.51s)
--- PASS: TestAccAWSAutoScalingGroup_withPlacementGroup (143.66s)

@gdavison
Copy link
Contributor Author

I had a couple reasons for putting this in the resource instead of creating a new resource:

  1. The refresh is an operation on a resource, not a resource in itself, and is triggered by changes to the resource. We'd have to have a synthetic output of the ASG that would be used solely to trigger a refresh configured in an external resource.
  2. A refresh operation can occur concurrently with scaling operations. If we have an ASG configured to wait for scaling operations, we would end up creating new instances with the old configuration and then handing off to the refresh resource which would cycle them all.

@ghost
Copy link

ghost commented Dec 18, 2020

This has been released in version 3.22.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 for triage. Thanks!

@YakDriver YakDriver deleted the f-aws_autoscaling_group-instance_refresh branch December 18, 2020 22:26
@ghost
Copy link

ghost commented Jan 18, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/autoscaling Issues and PRs that pertain to the autoscaling service. size/XXL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ASG Instance Refresh
4 participants