From 2057bd3dae8504f633822c75817590b3a26bb9ae Mon Sep 17 00:00:00 2001 From: Marcelo Tellier Sartori Vaz Date: Thu, 26 Jan 2023 18:36:20 -0300 Subject: [PATCH 01/10] Add support for allowed_instance_types in launch templates --- internal/service/autoscaling/group.go | 14 +++++++++++ internal/service/ec2/ec2_fleet.go | 6 +++++ internal/service/ec2/ec2_launch_template.go | 24 +++++++++++++++---- .../ec2/ec2_launch_template_data_source.go | 5 ++++ .../service/ec2/ec2_spot_fleet_request.go | 11 +++++++++ 5 files changed, 56 insertions(+), 4 deletions(-) diff --git a/internal/service/autoscaling/group.go b/internal/service/autoscaling/group.go index 2986231bab8f..f922edde6a5c 100644 --- a/internal/service/autoscaling/group.go +++ b/internal/service/autoscaling/group.go @@ -429,6 +429,12 @@ func ResourceGroup() *schema.Resource { ValidateFunc: validation.StringInSlice(autoscaling.AcceleratorType_Values(), false), }, }, + "allowed_instance_types": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 400, + Elem: &schema.Schema{Type: schema.TypeString}, + }, "bare_metal": { Type: schema.TypeString, Optional: true, @@ -2638,6 +2644,10 @@ func expandInstanceRequirements(tfMap map[string]interface{}) *autoscaling.Insta apiObject.AcceleratorTypes = flex.ExpandStringSet(v) } + if v, ok := tfMap["allowed_instance_types"].(*schema.Set); ok && v.Len() > 0 { + apiObject.AllowedInstanceTypes = flex.ExpandStringSet(v) + } + if v, ok := tfMap["bare_metal"].(string); ok && v != "" { apiObject.BareMetal = aws.String(v) } @@ -3301,6 +3311,10 @@ func flattenInstanceRequirements(apiObject *autoscaling.InstanceRequirements) ma tfMap["accelerator_types"] = aws.StringValueSlice(v) } + if v := apiObject.AllowedInstanceTypes; v != nil { + tfMap["allowed_instance_types"] = aws.StringValueSlice(v) + } + if v := apiObject.BareMetal; v != nil { tfMap["bare_metal"] = aws.StringValue(v) } diff --git a/internal/service/ec2/ec2_fleet.go b/internal/service/ec2/ec2_fleet.go index 10bbf8571041..e1a9aa865fa3 100644 --- a/internal/service/ec2/ec2_fleet.go +++ b/internal/service/ec2/ec2_fleet.go @@ -180,6 +180,12 @@ func ResourceFleet() *schema.Resource { ValidateFunc: validation.StringInSlice(ec2.AcceleratorType_Values(), false), }, }, + "allowed_instance_types": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 400, + Elem: &schema.Schema{Type: schema.TypeString}, + }, "bare_metal": { Type: schema.TypeString, Optional: true, diff --git a/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index ce656e66c81b..7d67991c9446 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -411,6 +411,13 @@ func ResourceLaunchTemplate() *schema.Resource { ValidateFunc: validation.StringInSlice(ec2.AcceleratorType_Values(), false), }, }, + "allowed_instance_types": { + Type: schema.TypeSet, + Optional: true, + MaxItems: 400, + Elem: &schema.Schema{Type: schema.TypeString}, + ConflictsWith: []string{"instance_requirements.0.excluded_instance_types"}, + }, "bare_metal": { Type: schema.TypeString, Optional: true, @@ -449,10 +456,11 @@ func ResourceLaunchTemplate() *schema.Resource { }, }, "excluded_instance_types": { - Type: schema.TypeSet, - Optional: true, - MaxItems: 400, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Optional: true, + MaxItems: 400, + Elem: &schema.Schema{Type: schema.TypeString}, + ConflictsWith: []string{"instance_requirements.0.allowed_instance_types"}, }, "instance_generations": { Type: schema.TypeSet, @@ -1592,6 +1600,10 @@ func expandInstanceRequirementsRequest(tfMap map[string]interface{}) *ec2.Instan apiObject.AcceleratorTypes = flex.ExpandStringSet(v) } + if v, ok := tfMap["allowed_instance_types"].(*schema.Set); ok && v.Len() > 0 { + apiObject.AllowedInstanceTypes = flex.ExpandStringSet(v) + } + if v, ok := tfMap["bare_metal"].(string); ok && v != "" { apiObject.BareMetal = aws.String(v) } @@ -2588,6 +2600,10 @@ func flattenInstanceRequirements(apiObject *ec2.InstanceRequirements) map[string tfMap["accelerator_types"] = aws.StringValueSlice(v) } + if v := apiObject.AllowedInstanceTypes; v != nil { + tfMap["allowed_instance_types"] = aws.StringValueSlice(v) + } + if v := apiObject.BareMetal; v != nil { tfMap["bare_metal"] = aws.StringValue(v) } diff --git a/internal/service/ec2/ec2_launch_template_data_source.go b/internal/service/ec2/ec2_launch_template_data_source.go index 3a7b14dd424d..376aa0adb38f 100644 --- a/internal/service/ec2/ec2_launch_template_data_source.go +++ b/internal/service/ec2/ec2_launch_template_data_source.go @@ -336,6 +336,11 @@ func DataSourceLaunchTemplate() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, + "allowed_instance_types": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, "bare_metal": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go index c1571fc30c60..77eb386fc412 100644 --- a/internal/service/ec2/ec2_spot_fleet_request.go +++ b/internal/service/ec2/ec2_spot_fleet_request.go @@ -470,6 +470,13 @@ func ResourceSpotFleetRequest() *schema.Resource { ValidateFunc: validation.StringInSlice(ec2.AcceleratorType_Values(), false), }, }, + "allowed_instance_types": { + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + MaxItems: 400, + Elem: &schema.Schema{Type: schema.TypeString}, + }, "bare_metal": { Type: schema.TypeString, Optional: true, @@ -1601,6 +1608,10 @@ func expandInstanceRequirements(tfMap map[string]interface{}) *ec2.InstanceRequi apiObject.AcceleratorTypes = flex.ExpandStringSet(v) } + if v, ok := tfMap["allowed_instance_types"].(*schema.Set); ok && v.Len() > 0 { + apiObject.AllowedInstanceTypes = flex.ExpandStringSet(v) + } + if v, ok := tfMap["bare_metal"].(string); ok && v != "" { apiObject.BareMetal = aws.String(v) } From d33fcb410e79443dcac536560fe5efe5769cba86 Mon Sep 17 00:00:00 2001 From: Marcelo Tellier Sartori Vaz Date: Fri, 27 Jan 2023 09:21:11 -0300 Subject: [PATCH 02/10] Add tests for allowed_instance_types --- internal/service/autoscaling/group_test.go | 60 +++++++++++++++++ internal/service/ec2/ec2_fleet_test.go | 67 +++++++++++++++++++ .../service/ec2/ec2_launch_template_test.go | 59 ++++++++++++++++ 3 files changed, 186 insertions(+) diff --git a/internal/service/autoscaling/group_test.go b/internal/service/autoscaling/group_test.go index 6150be7bd4a2..916ca70a224e 100644 --- a/internal/service/autoscaling/group_test.go +++ b/internal/service/autoscaling/group_test.go @@ -2290,6 +2290,66 @@ func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instance }) } +func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_allowedInstanceTypes(t *testing.T) { + ctx := acctest.Context(t) + var group autoscaling.Group + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_autoscaling_group.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, autoscaling.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckGroupDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, + `allowed_instance_types = ["t2.nano"] + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.#", "1"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), + ), + }, + testAccGroupImportStep(resourceName), + { + Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, + `allowed_instance_types = ["t2.nano", "t3*", "t4g.*"] + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.#", "3"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t3*"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t4g.*"), + ), + }, + testAccGroupImportStep(resourceName), + }, + }) +} + func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_bareMetal(t *testing.T) { ctx := acctest.Context(t) var group autoscaling.Group diff --git a/internal/service/ec2/ec2_fleet_test.go b/internal/service/ec2/ec2_fleet_test.go index ed5aadedad9c..07ec3a64a56c 100644 --- a/internal/service/ec2/ec2_fleet_test.go +++ b/internal/service/ec2/ec2_fleet_test.go @@ -834,6 +834,73 @@ func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_acceleratorType }) } +func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_allowedInstanceTypes(t *testing.T) { + ctx := acctest.Context(t) + var fleet ec2.FleetData + resourceName := "aws_ec2_fleet.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t); testAccPreCheckFleet(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckFleetDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `allowed_instance_types = ["t2.nano"] + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckFleetExists(ctx, resourceName, &fleet), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.#", "1"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terminate_instances"}, + }, + { + Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `allowed_instance_types = ["t2.nano", "t3*", "t4g.*"] + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckFleetExists(ctx, resourceName, &fleet), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.#", "3"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t3*"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t4g.*"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terminate_instances"}, + }, + }, + }) +} + func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_bareMetal(t *testing.T) { ctx := acctest.Context(t) var fleet ec2.FleetData diff --git a/internal/service/ec2/ec2_launch_template_test.go b/internal/service/ec2/ec2_launch_template_test.go index ddc0970bfa0e..15748f60c9d5 100644 --- a/internal/service/ec2/ec2_launch_template_test.go +++ b/internal/service/ec2/ec2_launch_template_test.go @@ -1780,6 +1780,65 @@ func TestAccEC2LaunchTemplate_instanceRequirements_acceleratorTypes(t *testing.T }) } +func TestAccEC2LaunchTemplate_instanceRequirements_allowedInstanceTypes(t *testing.T) { + ctx := acctest.Context(t) + var template ec2.LaunchTemplate + resourceName := "aws_launch_template.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckLaunchTemplateDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `allowed_instance_types = ["t2.nano"] + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckLaunchTemplateExists(ctx, resourceName, &template), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.allowed_instance_types.#", "1"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t2.nano"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `allowed_instance_types = ["t2.nano", "t3*", "t4g.*"] + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckLaunchTemplateExists(ctx, resourceName, &template), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.allowed_instance_types.#", "3"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t2.nano"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t3*"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t4g.*"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccEC2LaunchTemplate_instanceRequirements_bareMetal(t *testing.T) { ctx := acctest.Context(t) var template ec2.LaunchTemplate From 79eac8cdc6e836af46147ee08eef5844aaacbb9c Mon Sep 17 00:00:00 2001 From: Marcelo Tellier Sartori Vaz Date: Fri, 27 Jan 2023 15:17:09 -0300 Subject: [PATCH 03/10] Update documentation --- website/docs/r/autoscaling_group.html.markdown | 9 ++++++++- website/docs/r/ec2_fleet.html.markdown | 9 ++++++++- website/docs/r/launch_template.html.markdown | 9 ++++++++- website/docs/r/spot_fleet_request.html.markdown | 9 ++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/website/docs/r/autoscaling_group.html.markdown b/website/docs/r/autoscaling_group.html.markdown index afa2877af342..1875ee3dc3ae 100644 --- a/website/docs/r/autoscaling_group.html.markdown +++ b/website/docs/r/autoscaling_group.html.markdown @@ -546,6 +546,10 @@ This configuration block supports the following: * inference ``` +* `allowed_instance_types` - (Optional) List of instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes. You can use strings with one or more wild cards, represented by an asterisk (\*), to allow an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are allowing the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are allowing all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is all instance types. + + ~> **NOTE:** If you specify `allowed_instance_types`, you can't specify `excluded_instance_types`. + * `bare_metal` - (Optional) Indicate whether bare metal instace types should be `included`, `excluded`, or `required`. Default is `excluded`. * `baseline_ebs_bandwidth_mbps` - (Optional) Block describing the minimum and maximum baseline EBS bandwidth, in Mbps. Default is no minimum or maximum. * `min` - (Optional) Minimum. @@ -562,7 +566,10 @@ This configuration block supports the following: * intel ``` -* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*). The following are examples: `c5*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. +* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*), to exclude an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. + + ~> **NOTE:** If you specify `excluded_instance_types`, you can't specify `allowed_instance_types`. + * `instance_generations` - (Optional) List of instance generation names. Default is any generation. ``` diff --git a/website/docs/r/ec2_fleet.html.markdown b/website/docs/r/ec2_fleet.html.markdown index 9b40c76fe24c..9e77673e0526 100644 --- a/website/docs/r/ec2_fleet.html.markdown +++ b/website/docs/r/ec2_fleet.html.markdown @@ -133,6 +133,10 @@ This configuration block supports the following: * inference ``` +* `allowed_instance_types` - (Optional) List of instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes. You can use strings with one or more wild cards, represented by an asterisk (\*), to allow an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are allowing the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are allowing all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is all instance types. + + ~> **NOTE:** If you specify `allowed_instance_types`, you can't specify `excluded_instance_types`. + * `bare_metal` - (Optional) Indicate whether bare metal instace types should be `included`, `excluded`, or `required`. Default is `excluded`. * `baseline_ebs_bandwidth_mbps` - (Optional) Block describing the minimum and maximum baseline EBS bandwidth, in Mbps. Default is no minimum or maximum. * `min` - (Optional) Minimum. @@ -149,7 +153,10 @@ This configuration block supports the following: * intel ``` -* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*). The following are examples: `c5*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. +* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*), to exclude an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. + + ~> **NOTE:** If you specify `excluded_instance_types`, you can't specify `allowed_instance_types`. + * `instance_generations` - (Optional) List of instance generation names. Default is any generation. ``` diff --git a/website/docs/r/launch_template.html.markdown b/website/docs/r/launch_template.html.markdown index 928970d2a037..5ff1dc73a191 100644 --- a/website/docs/r/launch_template.html.markdown +++ b/website/docs/r/launch_template.html.markdown @@ -304,6 +304,10 @@ This configuration block supports the following: * inference ``` +* `allowed_instance_types` - (Optional) List of instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes. You can use strings with one or more wild cards, represented by an asterisk (\*), to allow an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are allowing the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are allowing all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is all instance types. + + ~> **NOTE:** If you specify `allowed_instance_types`, you can't specify `excluded_instance_types`. + * `bare_metal` - (Optional) Indicate whether bare metal instace types should be `included`, `excluded`, or `required`. Default is `excluded`. * `baseline_ebs_bandwidth_mbps` - (Optional) Block describing the minimum and maximum baseline EBS bandwidth, in Mbps. Default is no minimum or maximum. * `min` - (Optional) Minimum. @@ -320,7 +324,10 @@ This configuration block supports the following: * intel ``` -* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*). The following are examples: `c5*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. +* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*), to exclude an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. + + ~> **NOTE:** If you specify `excluded_instance_types`, you can't specify `allowed_instance_types`. + * `instance_generations` - (Optional) List of instance generation names. Default is any generation. ``` diff --git a/website/docs/r/spot_fleet_request.html.markdown b/website/docs/r/spot_fleet_request.html.markdown index 9ce2129f8980..d02a1480c843 100644 --- a/website/docs/r/spot_fleet_request.html.markdown +++ b/website/docs/r/spot_fleet_request.html.markdown @@ -326,6 +326,10 @@ This configuration block supports the following: * inference ``` +* `allowed_instance_types` - (Optional) List of instance types to apply your specified attributes against. All other instance types are ignored, even if they match your specified attributes. You can use strings with one or more wild cards, represented by an asterisk (\*), to allow an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are allowing the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are allowing all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is all instance types. + + ~> **NOTE:** If you specify `allowed_instance_types`, you can't specify `excluded_instance_types`. + * `bare_metal` - (Optional) Indicate whether bare metal instace types should be `included`, `excluded`, or `required`. Default is `excluded`. * `baseline_ebs_bandwidth_mbps` - (Optional) Block describing the minimum and maximum baseline EBS bandwidth, in Mbps. Default is no minimum or maximum. * `min` - (Optional) Minimum. @@ -342,7 +346,10 @@ This configuration block supports the following: * intel ``` -* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*). The following are examples: `c5*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. +* `excluded_instance_types` - (Optional) List of instance types to exclude. You can use strings with one or more wild cards, represented by an asterisk (\*), to exclude an instance type, size, or generation. The following are examples: `m5.8xlarge`, `c5*.*`, `m5a.*`, `r*`, `*3*`. For example, if you specify `c5*`, you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*`, you are excluding all the M5a instance types, but not the M5n instance types. Maximum of 400 entries in the list; each entry is limited to 30 characters. Default is no excluded instance types. + + ~> **NOTE:** If you specify `excluded_instance_types`, you can't specify `allowed_instance_types`. + * `instance_generations` - (Optional) List of instance generation names. Default is any generation. ``` From 0e8188d7bac2138a21cfda7b5e442f2912424fac Mon Sep 17 00:00:00 2001 From: Marcelo Tellier Sartori Vaz Date: Fri, 27 Jan 2023 17:32:18 -0300 Subject: [PATCH 04/10] Instance requirements exclude burstable instances by default --- internal/service/autoscaling/group_test.go | 12 ++++++------ internal/service/ec2/ec2_fleet_test.go | 12 ++++++------ internal/service/ec2/ec2_launch_template_test.go | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/autoscaling/group_test.go b/internal/service/autoscaling/group_test.go index 916ca70a224e..9030b6537463 100644 --- a/internal/service/autoscaling/group_test.go +++ b/internal/service/autoscaling/group_test.go @@ -2304,7 +2304,7 @@ func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instance Steps: []resource.TestStep{ { Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, - `allowed_instance_types = ["t2.nano"] + `allowed_instance_types = ["m4.large"] memory_mib { min = 500 } @@ -2319,13 +2319,13 @@ func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instance resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.#", "1"), resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.#", "1"), - resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "m4.large"), ), }, testAccGroupImportStep(resourceName), { Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, - `allowed_instance_types = ["t2.nano", "t3*", "t4g.*"] + `allowed_instance_types = ["m4.large", "m5.*", "m6*"] memory_mib { min = 500 } @@ -2340,9 +2340,9 @@ func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instance resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.#", "1"), resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.#", "3"), - resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), - resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t3*"), - resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "t4g.*"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "m4.large"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "m5.*"), + resource.TestCheckTypeSetElemAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.allowed_instance_types.*", "m6*"), ), }, testAccGroupImportStep(resourceName), diff --git a/internal/service/ec2/ec2_fleet_test.go b/internal/service/ec2/ec2_fleet_test.go index 07ec3a64a56c..75a9d3402cdf 100644 --- a/internal/service/ec2/ec2_fleet_test.go +++ b/internal/service/ec2/ec2_fleet_test.go @@ -847,7 +847,7 @@ func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_allowedInstance Steps: []resource.TestStep{ { Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), - `allowed_instance_types = ["t2.nano"] + `allowed_instance_types = ["m4.large"] memory_mib { min = 500 } @@ -861,7 +861,7 @@ func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_allowedInstance resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.#", "1"), resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.#", "1"), - resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "m4.large"), ), }, { @@ -872,7 +872,7 @@ func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_allowedInstance }, { Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), - `allowed_instance_types = ["t2.nano", "t3*", "t4g.*"] + `allowed_instance_types = ["m4.large", "m5.*", "m6*"] memory_mib { min = 500 } @@ -886,9 +886,9 @@ func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_allowedInstance resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.#", "1"), resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.#", "3"), - resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t2.nano"), - resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t3*"), - resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "t4g.*"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "m4.large"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "m5.*"), + resource.TestCheckTypeSetElemAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.allowed_instance_types.*", "m6*"), ), }, { diff --git a/internal/service/ec2/ec2_launch_template_test.go b/internal/service/ec2/ec2_launch_template_test.go index 15748f60c9d5..a19fa0cea93f 100644 --- a/internal/service/ec2/ec2_launch_template_test.go +++ b/internal/service/ec2/ec2_launch_template_test.go @@ -1793,7 +1793,7 @@ func TestAccEC2LaunchTemplate_instanceRequirements_allowedInstanceTypes(t *testi Steps: []resource.TestStep{ { Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), - `allowed_instance_types = ["t2.nano"] + `allowed_instance_types = ["m4.large"] memory_mib { min = 500 } @@ -1804,7 +1804,7 @@ func TestAccEC2LaunchTemplate_instanceRequirements_allowedInstanceTypes(t *testi testAccCheckLaunchTemplateExists(ctx, resourceName, &template), resource.TestCheckResourceAttr(resourceName, "instance_requirements.#", "1"), resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.allowed_instance_types.#", "1"), - resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t2.nano"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "m4.large"), ), }, { @@ -1814,7 +1814,7 @@ func TestAccEC2LaunchTemplate_instanceRequirements_allowedInstanceTypes(t *testi }, { Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), - `allowed_instance_types = ["t2.nano", "t3*", "t4g.*"] + `allowed_instance_types = ["m4.large", "m5.*", "m6*"] memory_mib { min = 500 } @@ -1825,9 +1825,9 @@ func TestAccEC2LaunchTemplate_instanceRequirements_allowedInstanceTypes(t *testi testAccCheckLaunchTemplateExists(ctx, resourceName, &template), resource.TestCheckResourceAttr(resourceName, "instance_requirements.#", "1"), resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.allowed_instance_types.#", "3"), - resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t2.nano"), - resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t3*"), - resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "t4g.*"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "m4.large"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "m5.*"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "m6*"), ), }, { From 1e8ec1e0b09a676b4e161b98dc9985eb82851a53 Mon Sep 17 00:00:00 2001 From: Marcelo Tellier Sartori Vaz Date: Fri, 27 Jan 2023 19:05:14 -0300 Subject: [PATCH 05/10] Update changelog --- .changelog/29140.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .changelog/29140.txt diff --git a/.changelog/29140.txt b/.changelog/29140.txt new file mode 100644 index 000000000000..ca03dc91e1e9 --- /dev/null +++ b/.changelog/29140.txt @@ -0,0 +1,19 @@ +```release-note:enhancement +resource/aws_launch_template: Add `instance_requirements.allowed_instance_types` argument +``` + +```release-note:enhancement +resource/aws_ec2_fleet: Add `launch_template_config.override.instance_requirements.allowed_instance_types` argument +``` + +```release-note:enhancement +resource/aws_spot_fleet_request: Add `launch_template_config.overrides.instance_requirements.allowed_instance_types` argument +``` + +```release-note:enhancement +resource/aws_autoscaling_group: Add `mixed_instances_policy.launch_template.override.instance_requirements.allowed_instance_types` argument +``` + +```release-note:enhancement +data-source/aws_launch_template: Add `instance_requirements.allowed_instance_types` attribute +``` \ No newline at end of file From 14b000837e24752af84296dafb7b2b51c75b403c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 25 Feb 2023 15:43:50 -0500 Subject: [PATCH 06/10] r/aws_autoscaling_group: Add 'mixed_instances_policy.launch_template.override.instance_requirements.network_bandwidth_gbps' argument. Acceptance test output: % make testacc TESTARGS='-run=TestAccAutoScalingGroup_' PKG=autoscaling ACCTEST_PARALLELISM=3 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./internal/service/autoscaling/... -v -count 1 -parallel 3 -run=TestAccAutoScalingGroup_ -timeout 180m === RUN TestAccAutoScalingGroup_basic === PAUSE TestAccAutoScalingGroup_basic === RUN TestAccAutoScalingGroup_disappears === PAUSE TestAccAutoScalingGroup_disappears === RUN TestAccAutoScalingGroup_defaultInstanceWarmup === PAUSE TestAccAutoScalingGroup_defaultInstanceWarmup === RUN TestAccAutoScalingGroup_nameGenerated === PAUSE TestAccAutoScalingGroup_nameGenerated === RUN TestAccAutoScalingGroup_namePrefix === PAUSE TestAccAutoScalingGroup_namePrefix === RUN TestAccAutoScalingGroup_tags === PAUSE TestAccAutoScalingGroup_tags === RUN TestAccAutoScalingGroup_deprecatedTags === PAUSE TestAccAutoScalingGroup_deprecatedTags === RUN TestAccAutoScalingGroup_simple === PAUSE TestAccAutoScalingGroup_simple === RUN TestAccAutoScalingGroup_terminationPolicies === PAUSE TestAccAutoScalingGroup_terminationPolicies === 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_withScalingActivityErrorPlacementGroupNotSupportedOnInstanceType === PAUSE TestAccAutoScalingGroup_withScalingActivityErrorPlacementGroupNotSupportedOnInstanceType === RUN TestAccAutoScalingGroup_withScalingActivityErrorIncorrectInstanceArchitecture === PAUSE TestAccAutoScalingGroup_withScalingActivityErrorIncorrectInstanceArchitecture === RUN TestAccAutoScalingGroup_withNoScalingActivityErrorCorrectInstanceArchitecture === PAUSE TestAccAutoScalingGroup_withNoScalingActivityErrorCorrectInstanceArchitecture === RUN TestAccAutoScalingGroup_enablingMetrics === PAUSE TestAccAutoScalingGroup_enablingMetrics === RUN TestAccAutoScalingGroup_withMetrics === PAUSE TestAccAutoScalingGroup_withMetrics === RUN TestAccAutoScalingGroup_suspendingProcesses === PAUSE TestAccAutoScalingGroup_suspendingProcesses === RUN TestAccAutoScalingGroup_serviceLinkedRoleARN === PAUSE TestAccAutoScalingGroup_serviceLinkedRoleARN === RUN TestAccAutoScalingGroup_maxInstanceLifetime === PAUSE TestAccAutoScalingGroup_maxInstanceLifetime === RUN TestAccAutoScalingGroup_initialLifecycleHook === PAUSE TestAccAutoScalingGroup_initialLifecycleHook === RUN TestAccAutoScalingGroup_launchTemplate === PAUSE TestAccAutoScalingGroup_launchTemplate === RUN TestAccAutoScalingGroup_LaunchTemplate_update === PAUSE TestAccAutoScalingGroup_LaunchTemplate_update === RUN TestAccAutoScalingGroup_largeDesiredCapacity === PAUSE TestAccAutoScalingGroup_largeDesiredCapacity === 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_loadBalancers === PAUSE TestAccAutoScalingGroup_loadBalancers === RUN TestAccAutoScalingGroup_targetGroups === PAUSE TestAccAutoScalingGroup_targetGroups === RUN TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity === PAUSE TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity === RUN TestAccAutoScalingGroup_warmPool === PAUSE TestAccAutoScalingGroup_warmPool === RUN TestAccAutoScalingGroup_launchTempPartitionNum === PAUSE TestAccAutoScalingGroup_launchTempPartitionNum === RUN TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn === PAUSE TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn === 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_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity_withELB === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity_withELB === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryMiBAndVCPUCount === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryMiBAndVCPUCount === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorCount === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorCount === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorManufacturers === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorManufacturers === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorNames === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorNames === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTotalMemoryMiB === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTotalMemoryMiB === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTypes === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTypes === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_allowedInstanceTypes === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_allowedInstanceTypes === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_bareMetal === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_bareMetal === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_baselineEBSBandwidthMbps === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_baselineEBSBandwidthMbps === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_burstablePerformance === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_burstablePerformance === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_cpuManufacturers === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_cpuManufacturers === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_excludedInstanceTypes === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_excludedInstanceTypes === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_instanceGenerations === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_instanceGenerations === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorage === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorage === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorageTypes === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorageTypes === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryGiBPerVCPU === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryGiBPerVCPU === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkBandwidthGbps === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkBandwidthGbps === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkInterfaceCount === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkInterfaceCount === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_onDemandMaxPricePercentageOverLowestPrice === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_onDemandMaxPricePercentageOverLowestPrice === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_requireHibernateSupport === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_requireHibernateSupport === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_spotMaxPricePercentageOverLowestPrice === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_spotMaxPricePercentageOverLowestPrice === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_totalLocalStorageGB === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_totalLocalStorageGB === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeUnits === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeUnits === RUN TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeVCPU === PAUSE TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeVCPU === CONT TestAccAutoScalingGroup_basic === CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandBaseCapacity === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_allowedInstanceTypes --- PASS: TestAccAutoScalingGroup_basic (51.16s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeVCPU --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_allowedInstanceTypes (81.99s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeUnits --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandBaseCapacity (99.64s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_totalLocalStorageGB --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeUnits (119.27s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_spotMaxPricePercentageOverLowestPrice --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_totalLocalStorageGB (105.43s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_requireHibernateSupport --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_spotMaxPricePercentageOverLowestPrice (41.19s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_onDemandMaxPricePercentageOverLowestPrice --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_desiredCapacityTypeVCPU (198.27s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkInterfaceCount --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_requireHibernateSupport (66.10s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkBandwidthGbps --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_onDemandMaxPricePercentageOverLowestPrice (52.02s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryGiBPerVCPU --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkInterfaceCount (99.22s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorageTypes --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkBandwidthGbps (90.46s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorage --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryGiBPerVCPU (104.83s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_instanceGenerations --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorageTypes (76.26s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_excludedInstanceTypes --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_localStorage (103.82s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_cpuManufacturers --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_instanceGenerations (69.20s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_burstablePerformance --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_excludedInstanceTypes (65.00s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_baselineEBSBandwidthMbps --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_cpuManufacturers (70.83s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceTypeWithLaunchTemplateSpecification --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_burstablePerformance (104.73s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_bareMetal --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceTypeWithLaunchTemplateSpecification (37.37s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorCount --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_baselineEBSBandwidthMbps (95.81s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTotalMemoryMiB --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_bareMetal (92.71s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorNames --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorCount (102.17s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorManufacturers --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTotalMemoryMiB (102.41s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity_withELB --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorNames (75.87s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryMiBAndVCPUCount --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorManufacturers (73.88s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_memoryMiBAndVCPUCount (68.08s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotMaxPrice --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotMaxPrice (96.46s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceType --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity (170.02s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_version --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_weightedCapacity_withELB (235.46s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_launchTemplateName --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceType (63.65s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotAllocationStrategy --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_launchTemplateName (47.95s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotInstancePools --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateLaunchTemplateSpecification_version (65.46s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandPercentageAboveBaseCapacity --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotAllocationStrategy (39.52s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_updateToZeroOnDemandBaseCapacity --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_spotInstancePools (63.05s) === CONT TestAccAutoScalingGroup_serviceLinkedRoleARN --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandPercentageAboveBaseCapacity (63.19s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandAllocationStrategy --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_updateToZeroOnDemandBaseCapacity (68.14s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicy_capacityRebalance --- PASS: TestAccAutoScalingGroup_serviceLinkedRoleARN (48.32s) === CONT TestAccAutoScalingGroup_mixedInstancesPolicy --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyInstancesDistribution_onDemandAllocationStrategy (41.11s) === CONT TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn --- PASS: TestAccAutoScalingGroup_mixedInstancesPolicy (41.00s) === CONT TestAccAutoScalingGroup_launchTempPartitionNum --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicy_capacityRebalance (49.90s) === CONT TestAccAutoScalingGroup_warmPool --- PASS: TestAccAutoScalingGroup_launchTempPartitionNum (49.41s) === CONT TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity --- PASS: TestAccAutoScalingGroup_Destroy_whenProtectedFromScaleIn (135.40s) === CONT TestAccAutoScalingGroup_targetGroups --- PASS: TestAccAutoScalingGroup_targetGroups (158.52s) === CONT TestAccAutoScalingGroup_loadBalancers --- PASS: TestAccAutoScalingGroup_ALBTargetGroups_elbCapacity (260.87s) === CONT TestAccAutoScalingGroup_InstanceRefresh_triggers --- PASS: TestAccAutoScalingGroup_InstanceRefresh_triggers (122.57s) === CONT TestAccAutoScalingGroup_InstanceRefresh_start --- PASS: TestAccAutoScalingGroup_warmPool (486.11s) === CONT TestAccAutoScalingGroup_InstanceRefresh_basic --- PASS: TestAccAutoScalingGroup_loadBalancers (293.27s) === CONT TestAccAutoScalingGroup_largeDesiredCapacity --- PASS: TestAccAutoScalingGroup_InstanceRefresh_start (175.44s) === CONT TestAccAutoScalingGroup_LaunchTemplate_update --- PASS: TestAccAutoScalingGroup_InstanceRefresh_basic (261.23s) === CONT TestAccAutoScalingGroup_launchTemplate --- PASS: TestAccAutoScalingGroup_LaunchTemplate_update (143.50s) === CONT TestAccAutoScalingGroup_initialLifecycleHook --- PASS: TestAccAutoScalingGroup_largeDesiredCapacity (220.03s) === CONT TestAccAutoScalingGroup_maxInstanceLifetime --- PASS: TestAccAutoScalingGroup_launchTemplate (49.33s) === CONT TestAccAutoScalingGroup_withLoadBalancer --- PASS: TestAccAutoScalingGroup_maxInstanceLifetime (72.77s) === CONT TestAccAutoScalingGroup_suspendingProcesses --- PASS: TestAccAutoScalingGroup_initialLifecycleHook (223.20s) === CONT TestAccAutoScalingGroup_withMetrics --- PASS: TestAccAutoScalingGroup_withLoadBalancer (205.81s) === CONT TestAccAutoScalingGroup_enablingMetrics --- PASS: TestAccAutoScalingGroup_withMetrics (61.58s) === CONT TestAccAutoScalingGroup_withNoScalingActivityErrorCorrectInstanceArchitecture --- PASS: TestAccAutoScalingGroup_suspendingProcesses (216.83s) === CONT TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTypes --- PASS: TestAccAutoScalingGroup_enablingMetrics (73.97s) === CONT TestAccAutoScalingGroup_withPlacementGroup --- PASS: TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_acceleratorTypes (66.51s) === CONT TestAccAutoScalingGroup_withScalingActivityErrorPlacementGroupNotSupportedOnInstanceType --- PASS: TestAccAutoScalingGroup_withScalingActivityErrorPlacementGroupNotSupportedOnInstanceType (26.10s) === CONT TestAccAutoScalingGroup_tags --- PASS: TestAccAutoScalingGroup_withNoScalingActivityErrorCorrectInstanceArchitecture (157.38s) === CONT TestAccAutoScalingGroup_vpcUpdates --- PASS: TestAccAutoScalingGroup_withPlacementGroup (116.83s) === CONT TestAccAutoScalingGroup_terminationPolicies --- PASS: TestAccAutoScalingGroup_tags (100.67s) === CONT TestAccAutoScalingGroup_simple --- PASS: TestAccAutoScalingGroup_vpcUpdates (73.47s) === CONT TestAccAutoScalingGroup_deprecatedTags --- PASS: TestAccAutoScalingGroup_terminationPolicies (117.05s) === CONT TestAccAutoScalingGroup_namePrefix --- PASS: TestAccAutoScalingGroup_deprecatedTags (48.32s) === CONT TestAccAutoScalingGroup_defaultInstanceWarmup --- PASS: TestAccAutoScalingGroup_namePrefix (48.31s) === CONT TestAccAutoScalingGroup_WithLoadBalancer_toTargetGroup --- PASS: TestAccAutoScalingGroup_defaultInstanceWarmup (62.05s) === CONT TestAccAutoScalingGroup_disappears --- PASS: TestAccAutoScalingGroup_disappears (29.01s) === CONT TestAccAutoScalingGroup_withScalingActivityErrorIncorrectInstanceArchitecture --- PASS: TestAccAutoScalingGroup_withScalingActivityErrorIncorrectInstanceArchitecture (27.06s) === CONT TestAccAutoScalingGroup_nameGenerated --- PASS: TestAccAutoScalingGroup_simple (194.18s) --- PASS: TestAccAutoScalingGroup_nameGenerated (48.03s) --- PASS: TestAccAutoScalingGroup_WithLoadBalancer_toTargetGroup (339.80s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling 2831.312s --- .changelog/29140.txt | 2 +- internal/service/autoscaling/group.go | 65 ++++++++++++++ internal/service/autoscaling/group_test.go | 87 +++++++++++++++++++ .../docs/r/autoscaling_group.html.markdown | 3 + 4 files changed, 156 insertions(+), 1 deletion(-) diff --git a/.changelog/29140.txt b/.changelog/29140.txt index ca03dc91e1e9..c3ac694e6549 100644 --- a/.changelog/29140.txt +++ b/.changelog/29140.txt @@ -11,7 +11,7 @@ resource/aws_spot_fleet_request: Add `launch_template_config.overrides.instance_ ``` ```release-note:enhancement -resource/aws_autoscaling_group: Add `mixed_instances_policy.launch_template.override.instance_requirements.allowed_instance_types` argument +resource/aws_autoscaling_group: Add `mixed_instances_policy.launch_template.override.instance_requirements.allowed_instance_types` and `mixed_instances_policy.launch_template.override.instance_requirements.network_bandwidth_gbps` arguments ``` ```release-note:enhancement diff --git a/internal/service/autoscaling/group.go b/internal/service/autoscaling/group.go index 967576e655a3..ee0a2316d213 100644 --- a/internal/service/autoscaling/group.go +++ b/internal/service/autoscaling/group.go @@ -541,6 +541,25 @@ func ResourceGroup() *schema.Resource { }, }, }, + "network_bandwidth_gbps": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max": { + Type: schema.TypeFloat, + Optional: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + "min": { + Type: schema.TypeFloat, + Optional: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + }, + }, + }, "network_interface_count": { Type: schema.TypeList, Optional: true, @@ -2692,6 +2711,10 @@ func expandInstanceRequirements(tfMap map[string]interface{}) *autoscaling.Insta apiObject.MemoryMiB = expandMemoryMiBRequest(v[0].(map[string]interface{})) } + if v, ok := tfMap["network_bandwidth_gbps"].([]interface{}); ok && len(v) > 0 { + apiObject.NetworkBandwidthGbps = expandNetworkBandwidthGbpsRequest(v[0].(map[string]interface{})) + } + if v, ok := tfMap["network_interface_count"].([]interface{}); ok && len(v) > 0 { apiObject.NetworkInterfaceCount = expandNetworkInterfaceCountRequest(v[0].(map[string]interface{})) } @@ -2819,6 +2842,26 @@ func expandMemoryMiBRequest(tfMap map[string]interface{}) *autoscaling.MemoryMiB return apiObject } +func expandNetworkBandwidthGbpsRequest(tfMap map[string]interface{}) *autoscaling.NetworkBandwidthGbpsRequest { + if tfMap == nil { + return nil + } + + apiObject := &autoscaling.NetworkBandwidthGbpsRequest{} + + var min float64 + if v, ok := tfMap["min"].(float64); ok { + min = v + apiObject.Min = aws.Float64(v) + } + + if v, ok := tfMap["max"].(float64); ok && v >= min { + apiObject.Max = aws.Float64(v) + } + + return apiObject +} + func expandNetworkInterfaceCountRequest(tfMap map[string]interface{}) *autoscaling.NetworkInterfaceCountRequest { if tfMap == nil { return nil @@ -3363,6 +3406,10 @@ func flattenInstanceRequirements(apiObject *autoscaling.InstanceRequirements) ma tfMap["memory_mib"] = []interface{}{flattenMemoryMiB(v)} } + if v := apiObject.NetworkBandwidthGbps; v != nil { + tfMap["network_bandwidth_gbps"] = []interface{}{flattenNetworkBandwidthGbps(v)} + } + if v := apiObject.NetworkInterfaceCount; v != nil { tfMap["network_interface_count"] = []interface{}{flattenNetworkInterfaceCount(v)} } @@ -3480,6 +3527,24 @@ func flattenMemoryMiB(apiObject *autoscaling.MemoryMiBRequest) map[string]interf return tfMap } +func flattenNetworkBandwidthGbps(apiObject *autoscaling.NetworkBandwidthGbpsRequest) map[string]interface{} { + if apiObject == nil { + return nil + } + + tfMap := map[string]interface{}{} + + if v := apiObject.Max; v != nil { + tfMap["max"] = aws.Float64Value(v) + } + + if v := apiObject.Min; v != nil { + tfMap["min"] = aws.Float64Value(v) + } + + return tfMap +} + func flattenNetworkInterfaceCount(apiObject *autoscaling.NetworkInterfaceCountRequest) map[string]interface{} { if apiObject == nil { return nil diff --git a/internal/service/autoscaling/group_test.go b/internal/service/autoscaling/group_test.go index c584a102db46..2d9bdc7eaca5 100644 --- a/internal/service/autoscaling/group_test.go +++ b/internal/service/autoscaling/group_test.go @@ -3009,6 +3009,93 @@ func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instance }) } +func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkBandwidthGbps(t *testing.T) { + ctx := acctest.Context(t) + var group autoscaling.Group + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_autoscaling_group.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, autoscaling.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckGroupDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, + `network_bandwidth_gbps { + min = 1.5 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.min", "1.5"), + ), + }, + testAccGroupImportStep(resourceName), + { + Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, + `network_bandwidth_gbps { + max = 200 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.max", "200"), + ), + }, + testAccGroupImportStep(resourceName), + { + Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, + `network_bandwidth_gbps { + min = 2.5 + max = 250 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &group), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.min", "2.5"), + resource.TestCheckResourceAttr(resourceName, "mixed_instances_policy.0.launch_template.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.max", "250"), + ), + }, + testAccGroupImportStep(resourceName), + }, + }) +} + func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_networkInterfaceCount(t *testing.T) { ctx := acctest.Context(t) var group autoscaling.Group diff --git a/website/docs/r/autoscaling_group.html.markdown b/website/docs/r/autoscaling_group.html.markdown index 579ca816e4c0..cc6f1f7d5359 100644 --- a/website/docs/r/autoscaling_group.html.markdown +++ b/website/docs/r/autoscaling_group.html.markdown @@ -593,6 +593,9 @@ This configuration block supports the following: * `memory_mib` - (Required) Block describing the minimum and maximum amount of memory (MiB). Default is no maximum. * `min` - (Required) Minimum. * `max` - (Optional) Maximum. +* `network_bandwidth_gbps` - (Optional) Block describing the minimum and maximum amount of network bandwidth, in gigabits per second (Gbps). Default is no minimum or maximum. + * `min` - (Optional) Minimum. + * `max` - (Optional) Maximum. * `network_interface_count` - (Optional) Block describing the minimum and maximum number of network interfaces. Default is no minimum or maximum. * `min` - (Optional) Minimum. * `max` - (Optional) Maximum. From d6af27cdfda9c7d38c332932864b7874e684e82f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 25 Feb 2023 15:51:53 -0500 Subject: [PATCH 07/10] r/aws_ec2_fleet: Add 'launch_template_config.override.instance_requirements.network_bandwidth_gbps' argument. --- .changelog/29140.txt | 2 +- internal/service/ec2/ec2_fleet.go | 19 +++++ internal/service/ec2/ec2_fleet_test.go | 98 ++++++++++++++++++++++++++ website/docs/r/ec2_fleet.html.markdown | 3 + 4 files changed, 121 insertions(+), 1 deletion(-) diff --git a/.changelog/29140.txt b/.changelog/29140.txt index c3ac694e6549..f18ad749db3f 100644 --- a/.changelog/29140.txt +++ b/.changelog/29140.txt @@ -3,7 +3,7 @@ resource/aws_launch_template: Add `instance_requirements.allowed_instance_types` ``` ```release-note:enhancement -resource/aws_ec2_fleet: Add `launch_template_config.override.instance_requirements.allowed_instance_types` argument +resource/aws_ec2_fleet: Add `launch_template_config.override.instance_requirements.allowed_instance_types` and `launch_template_config.override.instance_requirements.network_bandwidth_gbps` arguments ``` ```release-note:enhancement diff --git a/internal/service/ec2/ec2_fleet.go b/internal/service/ec2/ec2_fleet.go index 4f53a088c71a..8fed50a38eb7 100644 --- a/internal/service/ec2/ec2_fleet.go +++ b/internal/service/ec2/ec2_fleet.go @@ -288,6 +288,25 @@ func ResourceFleet() *schema.Resource { }, }, }, + "network_bandwidth_gbps": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max": { + Type: schema.TypeFloat, + Optional: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + "min": { + Type: schema.TypeFloat, + Optional: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + }, + }, + }, "network_interface_count": { Type: schema.TypeList, Optional: true, diff --git a/internal/service/ec2/ec2_fleet_test.go b/internal/service/ec2/ec2_fleet_test.go index 75a9d3402cdf..84aaecadcc02 100644 --- a/internal/service/ec2/ec2_fleet_test.go +++ b/internal/service/ec2/ec2_fleet_test.go @@ -1624,6 +1624,104 @@ func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_memoryGiBPerVCP }) } +func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_networkBandwidthGbps(t *testing.T) { + ctx := acctest.Context(t) + var fleet ec2.FleetData + resourceName := "aws_ec2_fleet.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t); testAccPreCheckFleet(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckFleetDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `network_bandwidth_gbps { + min = 1.5 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckFleetExists(ctx, resourceName, &fleet), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.min", "1.5"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terminate_instances"}, + }, + { + Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `network_bandwidth_gbps { + max = 200 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckFleetExists(ctx, resourceName, &fleet), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.max", "200"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terminate_instances"}, + }, + { + Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `network_bandwidth_gbps { + min = 2.5 + max = 250 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckFleetExists(ctx, resourceName, &fleet), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.#", "1"), + + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.min", "2.5"), + resource.TestCheckResourceAttr(resourceName, "launch_template_config.0.override.0.instance_requirements.0.network_bandwidth_gbps.0.max", "250"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terminate_instances"}, + }, + }, + }) +} + func TestAccEC2Fleet_LaunchTemplateOverride_instanceRequirements_networkInterfaceCount(t *testing.T) { ctx := acctest.Context(t) var fleet ec2.FleetData diff --git a/website/docs/r/ec2_fleet.html.markdown b/website/docs/r/ec2_fleet.html.markdown index 9e77673e0526..8e7026ef4447 100644 --- a/website/docs/r/ec2_fleet.html.markdown +++ b/website/docs/r/ec2_fleet.html.markdown @@ -180,6 +180,9 @@ This configuration block supports the following: * `memory_mib` - (Required) Block describing the minimum and maximum amount of memory (MiB). Default is no maximum. * `min` - (Required) Minimum. * `max` - (Optional) Maximum. +* `network_bandwidth_gbps` - (Optional) Block describing the minimum and maximum amount of network bandwidth, in gigabits per second (Gbps). Default is no minimum or maximum. + * `min` - (Optional) Minimum. + * `max` - (Optional) Maximum. * `network_interface_count` - (Optional) Block describing the minimum and maximum number of network interfaces. Default is no minimum or maximum. * `min` - (Optional) Minimum. * `max` - (Optional) Maximum. From d6e7bde543e94ff3cc10e0763d304a326c5e9ea2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 25 Feb 2023 15:56:19 -0500 Subject: [PATCH 08/10] r/aws_spot_fleet_request: Add 'launch_template_config.overrides.instance_requirements.network_bandwidth_gbps' argument. --- .changelog/29140.txt | 2 +- .../service/ec2/ec2_spot_fleet_request.go | 22 +++++++++++++++++++ .../docs/r/spot_fleet_request.html.markdown | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.changelog/29140.txt b/.changelog/29140.txt index f18ad749db3f..be4fcf1507c1 100644 --- a/.changelog/29140.txt +++ b/.changelog/29140.txt @@ -7,7 +7,7 @@ resource/aws_ec2_fleet: Add `launch_template_config.override.instance_requiremen ``` ```release-note:enhancement -resource/aws_spot_fleet_request: Add `launch_template_config.overrides.instance_requirements.allowed_instance_types` argument +resource/aws_spot_fleet_request: Add `launch_template_config.overrides.instance_requirements.allowed_instance_types` and `launch_template_config.overrides.instance_requirements.network_bandwidth_gbps` arguments ``` ```release-note:enhancement diff --git a/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go index 2c6cf5e4bca0..bea275193175 100644 --- a/internal/service/ec2/ec2_spot_fleet_request.go +++ b/internal/service/ec2/ec2_spot_fleet_request.go @@ -595,6 +595,28 @@ func ResourceSpotFleetRequest() *schema.Resource { }, }, }, + "network_bandwidth_gbps": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max": { + Type: schema.TypeFloat, + Optional: true, + ForceNew: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + "min": { + Type: schema.TypeFloat, + Optional: true, + ForceNew: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + }, + }, + }, "network_interface_count": { Type: schema.TypeList, Optional: true, diff --git a/website/docs/r/spot_fleet_request.html.markdown b/website/docs/r/spot_fleet_request.html.markdown index d02a1480c843..6a2d6bbf94c8 100644 --- a/website/docs/r/spot_fleet_request.html.markdown +++ b/website/docs/r/spot_fleet_request.html.markdown @@ -373,6 +373,9 @@ This configuration block supports the following: * `memory_mib` - (Optional) Block describing the minimum and maximum amount of memory (MiB). Default is no maximum. * `min` - (Optional) Minimum. * `max` - (Optional) Maximum. +* `network_bandwidth_gbps` - (Optional) Block describing the minimum and maximum amount of network bandwidth, in gigabits per second (Gbps). Default is no minimum or maximum. + * `min` - (Optional) Minimum. + * `max` - (Optional) Maximum. * `network_interface_count` - (Optional) Block describing the minimum and maximum number of network interfaces. Default is no minimum or maximum. * `min` - (Optional) Minimum. * `max` - (Optional) Maximum. From d9f67879a9d5c87d934f64f42263be5a5948857b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 25 Feb 2023 16:03:38 -0500 Subject: [PATCH 09/10] r/aws_launch_template: Add 'instance_requirements.network_bandwidth_gbps' argument. --- .changelog/29140.txt | 2 +- internal/service/ec2/ec2_launch_template.go | 65 ++++++++++++++ .../service/ec2/ec2_launch_template_test.go | 86 +++++++++++++++++++ website/docs/r/launch_template.html.markdown | 3 + 4 files changed, 155 insertions(+), 1 deletion(-) diff --git a/.changelog/29140.txt b/.changelog/29140.txt index be4fcf1507c1..050fd16ee8d2 100644 --- a/.changelog/29140.txt +++ b/.changelog/29140.txt @@ -1,5 +1,5 @@ ```release-note:enhancement -resource/aws_launch_template: Add `instance_requirements.allowed_instance_types` argument +resource/aws_launch_template: Add `instance_requirements.allowed_instance_types` and `instance_requirements.network_bandwidth_gbps` arguments ``` ```release-note:enhancement diff --git a/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index a4de7e310d3e..7e8e808a2aa9 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -510,6 +510,25 @@ func ResourceLaunchTemplate() *schema.Resource { }, }, }, + "network_bandwidth_gbps": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max": { + Type: schema.TypeFloat, + Optional: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + "min": { + Type: schema.TypeFloat, + Optional: true, + ValidateFunc: verify.FloatGreaterThan(0.0), + }, + }, + }, + }, "network_interface_count": { Type: schema.TypeList, Optional: true, @@ -1623,6 +1642,10 @@ func expandInstanceRequirementsRequest(tfMap map[string]interface{}) *ec2.Instan apiObject.MemoryMiB = expandMemoryMiBRequest(v[0].(map[string]interface{})) } + if v, ok := tfMap["network_bandwidth_gbps"].([]interface{}); ok && len(v) > 0 { + apiObject.NetworkBandwidthGbps = expandNetworkBandwidthGbpsRequest(v[0].(map[string]interface{})) + } + if v, ok := tfMap["network_interface_count"].([]interface{}); ok && len(v) > 0 { apiObject.NetworkInterfaceCount = expandNetworkInterfaceCountRequest(v[0].(map[string]interface{})) } @@ -1750,6 +1773,26 @@ func expandMemoryMiBRequest(tfMap map[string]interface{}) *ec2.MemoryMiBRequest return apiObject } +func expandNetworkBandwidthGbpsRequest(tfMap map[string]interface{}) *ec2.NetworkBandwidthGbpsRequest { + if tfMap == nil { + return nil + } + + apiObject := &ec2.NetworkBandwidthGbpsRequest{} + + var min float64 + if v, ok := tfMap["min"].(float64); ok { + min = v + apiObject.Min = aws.Float64(v) + } + + if v, ok := tfMap["max"].(float64); ok && v >= min { + apiObject.Max = aws.Float64(v) + } + + return apiObject +} + func expandNetworkInterfaceCountRequest(tfMap map[string]interface{}) *ec2.NetworkInterfaceCountRequest { if tfMap == nil { return nil @@ -2617,6 +2660,10 @@ func flattenInstanceRequirements(apiObject *ec2.InstanceRequirements) map[string tfMap["memory_mib"] = []interface{}{flattenMemoryMiB(v)} } + if v := apiObject.NetworkBandwidthGbps; v != nil { + tfMap["network_bandwidth_gbps"] = []interface{}{flattenNetworkBandwidthGbps(v)} + } + if v := apiObject.NetworkInterfaceCount; v != nil { tfMap["network_interface_count"] = []interface{}{flattenNetworkInterfaceCount(v)} } @@ -2734,6 +2781,24 @@ func flattenMemoryMiB(apiObject *ec2.MemoryMiB) map[string]interface{} { return tfMap } +func flattenNetworkBandwidthGbps(apiObject *ec2.NetworkBandwidthGbps) map[string]interface{} { + if apiObject == nil { + return nil + } + + tfMap := map[string]interface{}{} + + if v := apiObject.Max; v != nil { + tfMap["max"] = aws.Float64Value(v) + } + + if v := apiObject.Min; v != nil { + tfMap["min"] = aws.Float64Value(v) + } + + return tfMap +} + func flattenNetworkInterfaceCount(apiObject *ec2.NetworkInterfaceCount) map[string]interface{} { if apiObject == nil { return nil diff --git a/internal/service/ec2/ec2_launch_template_test.go b/internal/service/ec2/ec2_launch_template_test.go index 91c373f7b107..2547b6681e80 100644 --- a/internal/service/ec2/ec2_launch_template_test.go +++ b/internal/service/ec2/ec2_launch_template_test.go @@ -2473,6 +2473,92 @@ func TestAccEC2LaunchTemplate_instanceRequirements_memoryGiBPerVCPU(t *testing.T }) } +func TestAccEC2LaunchTemplate_instanceRequirements_networkBandwidthGbps(t *testing.T) { + ctx := acctest.Context(t) + var template ec2.LaunchTemplate + resourceName := "aws_launch_template.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckLaunchTemplateDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `network_bandwidth_gbps { + min = 1.5 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckLaunchTemplateExists(ctx, resourceName, &template), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.network_bandwidth_gbps.0.min", "1.5"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `network_bandwidth_gbps { + max = 200 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckLaunchTemplateExists(ctx, resourceName, &template), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.network_bandwidth_gbps.0.max", "200"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `network_bandwidth_gbps { + min = 2.5 + max = 250 + } + memory_mib { + min = 500 + } + vcpu_count { + min = 1 + }`), + Check: resource.ComposeTestCheckFunc( + testAccCheckLaunchTemplateExists(ctx, resourceName, &template), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.network_bandwidth_gbps.#", "1"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.network_bandwidth_gbps.0.min", "2.5"), + resource.TestCheckResourceAttr(resourceName, "instance_requirements.0.network_bandwidth_gbps.0.max", "250"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccEC2LaunchTemplate_instanceRequirements_networkInterfaceCount(t *testing.T) { ctx := acctest.Context(t) var template ec2.LaunchTemplate diff --git a/website/docs/r/launch_template.html.markdown b/website/docs/r/launch_template.html.markdown index 9f5f24cfd524..6d80a981959f 100644 --- a/website/docs/r/launch_template.html.markdown +++ b/website/docs/r/launch_template.html.markdown @@ -352,6 +352,9 @@ This configuration block supports the following: * `memory_mib` - (Required) Block describing the minimum and maximum amount of memory (MiB). Default is no maximum. * `min` - (Required) Minimum. * `max` - (Optional) Maximum. +* `network_bandwidth_gbps` - (Optional) Block describing the minimum and maximum amount of network bandwidth, in gigabits per second (Gbps). Default is no minimum or maximum. + * `min` - (Optional) Minimum. + * `max` - (Optional) Maximum. * `network_interface_count` - (Optional) Block describing the minimum and maximum number of network interfaces. Default is no minimum or maximum. * `min` - (Optional) Minimum. * `max` - (Optional) Maximum. From 3804dd52c68f7b2bf1b60b31b8a37ae584c2db6c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 25 Feb 2023 16:05:42 -0500 Subject: [PATCH 10/10] d/aws_launch_template: Add 'instance_requirements.network_bandwidth_gbps' attribute. --- .changelog/29140.txt | 2 +- .../ec2/ec2_launch_template_data_source.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.changelog/29140.txt b/.changelog/29140.txt index 050fd16ee8d2..974853125d89 100644 --- a/.changelog/29140.txt +++ b/.changelog/29140.txt @@ -15,5 +15,5 @@ resource/aws_autoscaling_group: Add `mixed_instances_policy.launch_template.over ``` ```release-note:enhancement -data-source/aws_launch_template: Add `instance_requirements.allowed_instance_types` attribute +data-source/aws_launch_template: Add `instance_requirements.allowed_instance_types` and `instance_requirements.network_bandwidth_gbps` attributes ``` \ No newline at end of file diff --git a/internal/service/ec2/ec2_launch_template_data_source.go b/internal/service/ec2/ec2_launch_template_data_source.go index c439c277a5b7..3dff66bbfa86 100644 --- a/internal/service/ec2/ec2_launch_template_data_source.go +++ b/internal/service/ec2/ec2_launch_template_data_source.go @@ -421,6 +421,22 @@ func DataSourceLaunchTemplate() *schema.Resource { }, }, }, + "network_bandwidth_gbps": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max": { + Type: schema.TypeFloat, + Computed: true, + }, + "min": { + Type: schema.TypeFloat, + Computed: true, + }, + }, + }, + }, "network_interface_count": { Type: schema.TypeList, Computed: true,