diff --git a/.changelog/29140.txt b/.changelog/29140.txt new file mode 100644 index 000000000000..974853125d89 --- /dev/null +++ b/.changelog/29140.txt @@ -0,0 +1,19 @@ +```release-note:enhancement +resource/aws_launch_template: Add `instance_requirements.allowed_instance_types` and `instance_requirements.network_bandwidth_gbps` arguments +``` + +```release-note:enhancement +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 +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 +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 +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/autoscaling/group.go b/internal/service/autoscaling/group.go index 15aa5cb04876..ee0a2316d213 100644 --- a/internal/service/autoscaling/group.go +++ b/internal/service/autoscaling/group.go @@ -433,6 +433,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, @@ -535,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, @@ -2642,6 +2667,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) } @@ -2682,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{})) } @@ -2809,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 @@ -3309,6 +3362,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) } @@ -3349,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)} } @@ -3466,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 4c81546e2d0e..2d9bdc7eaca5 100644 --- a/internal/service/autoscaling/group_test.go +++ b/internal/service/autoscaling/group_test.go @@ -2309,6 +2309,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 = ["m4.large"] + 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.*", "m4.large"), + ), + }, + testAccGroupImportStep(resourceName), + { + Config: testAccGroupConfig_mixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements(rName, + `allowed_instance_types = ["m4.large", "m5.*", "m6*"] + 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.*", "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), + }, + }) +} + func TestAccAutoScalingGroup_MixedInstancesPolicyLaunchTemplateOverride_instanceRequirements_bareMetal(t *testing.T) { ctx := acctest.Context(t) var group autoscaling.Group @@ -2949,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/internal/service/ec2/ec2_fleet.go b/internal/service/ec2/ec2_fleet.go index abe79bdce3ee..8fed50a38eb7 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, @@ -282,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 ed5aadedad9c..84aaecadcc02 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 = ["m4.large"] + 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.*", "m4.large"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"terminate_instances"}, + }, + { + Config: testAccFleetConfig_launchTemplateOverrideInstanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `allowed_instance_types = ["m4.large", "m5.*", "m6*"] + 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.*", "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*"), + ), + }, + { + 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 @@ -1557,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/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index 0f99e533cf69..7e8e808a2aa9 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -400,6 +400,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, @@ -438,10 +445,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, @@ -502,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, @@ -1571,6 +1598,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) } @@ -1611,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{})) } @@ -1738,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 @@ -2561,6 +2616,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) } @@ -2601,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)} } @@ -2718,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_data_source.go b/internal/service/ec2/ec2_launch_template_data_source.go index 006dd7126fa9..3dff66bbfa86 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, @@ -416,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, diff --git a/internal/service/ec2/ec2_launch_template_test.go b/internal/service/ec2/ec2_launch_template_test.go index b8dcee991527..2547b6681e80 100644 --- a/internal/service/ec2/ec2_launch_template_test.go +++ b/internal/service/ec2/ec2_launch_template_test.go @@ -1783,6 +1783,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 = ["m4.large"] + 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.*", "m4.large"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccLaunchTemplateConfig_instanceRequirements(sdkacctest.RandomWithPrefix(acctest.ResourcePrefix), + `allowed_instance_types = ["m4.large", "m5.*", "m6*"] + 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.*", "m4.large"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "m5.*"), + resource.TestCheckTypeSetElemAttr(resourceName, "instance_requirements.0.allowed_instance_types.*", "m6*"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccEC2LaunchTemplate_instanceRequirements_bareMetal(t *testing.T) { ctx := acctest.Context(t) var template ec2.LaunchTemplate @@ -2414,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/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go index d396adae134e..bea275193175 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, @@ -588,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, @@ -1601,6 +1630,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) } diff --git a/website/docs/r/autoscaling_group.html.markdown b/website/docs/r/autoscaling_group.html.markdown index 49639a728c25..cc6f1f7d5359 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. ``` @@ -586,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. diff --git a/website/docs/r/ec2_fleet.html.markdown b/website/docs/r/ec2_fleet.html.markdown index 9b40c76fe24c..8e7026ef4447 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. ``` @@ -173,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. diff --git a/website/docs/r/launch_template.html.markdown b/website/docs/r/launch_template.html.markdown index 52cfb815460f..6d80a981959f 100644 --- a/website/docs/r/launch_template.html.markdown +++ b/website/docs/r/launch_template.html.markdown @@ -305,6 +305,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. @@ -321,7 +325,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. ``` @@ -345,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. diff --git a/website/docs/r/spot_fleet_request.html.markdown b/website/docs/r/spot_fleet_request.html.markdown index 9ce2129f8980..6a2d6bbf94c8 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. ``` @@ -366,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.