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

Add Support Auto Scaling groups with multiple launch templates using a mixed instances policy #16325

Merged

Conversation

AdamTylerLynch
Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch commented Nov 19, 2020

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

Overview

Amazon EC2 Auto Scaling now lets you configure your Auto Scaling group with multiple launch templates when you use a MixedInstancesPolicy and specify multiple instance types. After EC2 Auto Scaling released support for multiple instance types within a single Auto Scaling group, customers have been looking for ways to launch different instance types using different Amazon Machine Images (AMIs) so that instances with incompatible CPU architectures can exist in the same Auto Scaling group. With this enhancement you can now specify a launch template alongside the instance type in the overrides of your MixedInstancesPolicy, and that launch template will be used whenever launching instances of its corresponding instance type.

Closes #16324

Release note for CHANGELOG:

resource/aws_autoscaling_group: Added support Auto Scaling groups with multiple launch templates using a mixed instances policy
docs/autoscaling_group:  Added documentation and usage sample for multiple launch templates in an Auto Scaling Group using a mixed instance policy.

Requires

Requires AWS SDK v1.35.32

Output from acceptance testing:

make testacc TESTARGS='-run=TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType -timeout 120m
=== RUN   TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType
=== PAUSE TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType
=== RUN   TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification
=== PAUSE TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification
=== CONT  TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType
=== CONT  TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification (51.42s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType (60.14s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       62.827s

...

@AdamTylerLynch AdamTylerLynch requested a review from a team as a code owner November 19, 2020 19:41
@ghost ghost added size/L Managed by automation to categorize the size of a PR. service/autoscaling Issues and PRs that pertain to the autoscaling service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 19, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 19, 2020
@AdamTylerLynch
Copy link
Collaborator Author

Looking for review and feedback to get it merged into the main branch.

@AdamTylerLynch AdamTylerLynch force-pushed the add_autoscaling_overrides_launchtemplate branch from 4d83795 to d5adfb6 Compare November 27, 2020 15:39
@AdamTylerLynch
Copy link
Collaborator Author

Synced fork with master branch.
Also fixed a merge issue where Capacity Rebalance was inadvertently removed from the docs.

@tonyghita
Copy link

@AdamTylerLynch thanks much for throwing this PR together. I'm looking forward to using this functionality to run both x86 and ARM instances in the same auto scaling group.

It looks like this PR gained a merge conflict since it was opened. Is there anyway I can help clear the merge conflict so we can get this PR reviewed and merged?

Base automatically changed from master to main January 23, 2021 00:59
@ghost ghost added the documentation Introduces or discusses updates to documentation. label Feb 2, 2021
@gdavison gdavison self-assigned this Feb 19, 2021
@gdavison gdavison removed the needs-triage Waiting for first response or review from a maintainer. label Feb 19, 2021
Copy link
Contributor

@gdavison gdavison 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 great, @AdamTylerLynch! I've suggested one minor tweak in the documentation and an addition to the new acceptance test.

aws/resource_aws_autoscaling_group_test.go Outdated Show resolved Hide resolved
website/docs/r/autoscaling_group.html.markdown Outdated Show resolved Hide resolved
…set. Verify that no override LT is set for x86.
…aunch template overrides in a mixed instance policy.
@AdamTylerLynch
Copy link
Collaborator Author

Output from acceptance tests:

make testacc TESTARGS='-run=TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType -timeout 120m
=== RUN   TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType
=== PAUSE TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType
=== RUN   TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification
=== PAUSE TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification
=== CONT  TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType
=== CONT  TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification (42.25s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType (59.24s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	63.530s

Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

Looks good 🚀

Acceptance test results in Commercial partition

--- PASS: TestAccAWSAutoScalingGroup_namePrefix (77.59s)
--- PASS: TestAccAWSAutoScalingGroup_serviceLinkedRoleARN (117.82s)
--- PASS: TestAccAWSAutoScalingGroup_VpcUpdates (118.03s)
--- PASS: TestAccAWSAutoScalingGroup_withMetrics (139.72s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (150.59s)
--- PASS: TestAccAWSAutoScalingGroup_MaxInstanceLifetime (152.07s)
--- PASS: TestAccAWSAutoScalingGroup_terminationPolicies (156.82s)
--- PASS: TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier (55.43s)
--- PASS: TestAccAWSAutoScalingGroup_withPlacementGroup (175.69s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate (62.95s)
--- PASS: TestAccAWSAutoScalingGroup_enablingMetrics (188.92s)
--- PASS: TestAccAWSAutoScalingGroup_TargetGroupArns (191.37s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy (44.95s)
--- PASS: TestAccAWSAutoScalingGroup_LaunchTemplate_IAMInstanceProfile (83.50s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandAllocationStrategy (58.21s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_CapacityRebalance (64.29s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotAllocationStrategy (61.64s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_UpdateToZeroOnDemandBaseCapacity (76.60s)
--- PASS: TestAccAWSAutoScalingGroup_initialLifecycleHook (267.69s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Basic (268.05s)
--- PASS: TestAccAWSAutoScalingGroup_suspendingProcesses (271.83s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer (274.51s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/empty_list (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/nil (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/defaults (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/instance_warmup_only (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/instance_warmup_zero (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/instance_warmup_empty_string (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/min_healthy_percentage_only (0.00s)
--- PASS: TestCreateAutoScalingGroupInstanceRefreshInput/preferences (0.00s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_LaunchTemplateName (38.86s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandBaseCapacity (97.68s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDemandPercentageAboveBaseCapacity (89.71s)
--- PASS: TestAccAWSAutoScalingGroup_launchTemplate_update (166.07s)
--- PASS: TestAccAWSAutoScalingGroup_basic (306.09s)
--- PASS: TestAccAWSAutoScalingGroup_launchTempPartitionNum (39.29s)
--- PASS: TestAccAWSAutoScalingGroup_tags (324.64s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType_With_LaunchTemplateSpecification (61.37s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Triggers (253.96s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotInstancePools (103.67s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_InstanceType (77.88s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotMaxPrice (110.85s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTemplateSpecification_Version (85.56s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (353.77s)
--- PASS: TestAccAWSAutoScalingGroup_InstanceRefresh_Start (357.89s)
--- PASS: TestAccAWSAutoScalingGroup_autoGeneratedName (428.44s)
--- PASS: TestAccAWSAutoScalingGroup_LoadBalancers (289.89s)
--- PASS: TestAccAWSAutoScalingGroup_WithLoadBalancer_ToTargetGroup (452.95s)
--- PASS: TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_WeightedCapacity (216.91s)

@breathingdust
Copy link
Member

Hi @AdamTylerLynch! Would you be able to add a file for the changelog? Then we can get this merged. Instructions are here:

Contents would be

```release-note:enhancement
resource/aws_autoscaling_group: Added support Auto Scaling groups with multiple launch templates using a mixed instances policy
```

@AdamTylerLynch
Copy link
Collaborator Author

I'm sorry about not including the changelog in the initial PR. My apologies.

@gdavison gdavison merged commit 9018311 into hashicorp:main Feb 25, 2021
@github-actions github-actions bot added this to the v3.30.0 milestone Feb 25, 2021
@ghost
Copy link

ghost commented Feb 26, 2021

This has been released in version 3.30.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!

@ghost
Copy link

ghost commented Mar 28, 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 Mar 28, 2021
@justinretzolk justinretzolk added the partner Contribution from a partner. label May 16, 2024
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. partner Contribution from a partner. service/autoscaling Issues and PRs that pertain to the autoscaling service. size/L 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 Auto Scaling groups with multiple launch templates using a mixed instances policy
5 participants