diff --git a/.changelog/25668.txt b/.changelog/25668.txt new file mode 100644 index 00000000000..6bf10090f00 --- /dev/null +++ b/.changelog/25668.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_emr_cluster: Add `gp3` EBS volume support +``` + +```release-note:enhancement +resource/aws_emr_cluster: Add `core_instance_group.ebs_config.throughput` and `master_instance_group.ebs_config.throughput` arguments +``` diff --git a/internal/service/emr/cluster.go b/internal/service/emr/cluster.go index f57b436d8e4..695b63cf82a 100644 --- a/internal/service/emr/cluster.go +++ b/internal/service/emr/cluster.go @@ -171,6 +171,11 @@ func ResourceCluster() *schema.Resource { Required: true, ForceNew: true, }, + "throughput": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, "type": { Type: schema.TypeString, Required: true, @@ -393,6 +398,11 @@ func ResourceCluster() *schema.Resource { Required: true, ForceNew: true, }, + "throughput": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, "type": { Type: schema.TypeString, Required: true, @@ -1666,6 +1676,9 @@ func flattenEBSConfig(ebsBlockDevices []*emr.EbsBlockDevice) *schema.Set { if ebs.VolumeSpecification.SizeInGB != nil { ebsAttrs["size"] = int(aws.Int64Value(ebs.VolumeSpecification.SizeInGB)) } + if ebs.VolumeSpecification.Throughput != nil { + ebsAttrs["throughput"] = aws.Int64Value(ebs.VolumeSpecification.Throughput) + } if ebs.VolumeSpecification.VolumeType != nil { ebsAttrs["type"] = aws.StringValue(ebs.VolumeSpecification.VolumeType) } @@ -1814,6 +1827,9 @@ func expandEBSConfig(configAttributes map[string]interface{}, config *emr.Instan VolumeType: aws.String(rawEbsConfig["type"].(string)), }, } + if v, ok := rawEbsConfig["throughput"].(int); ok && v != 0 { + ebsBlockDeviceConfig.VolumeSpecification.Throughput = aws.Int64(int64(v)) + } if v, ok := rawEbsConfig["iops"].(int); ok && v != 0 { ebsBlockDeviceConfig.VolumeSpecification.Iops = aws.Int64(int64(v)) } @@ -1909,6 +1925,9 @@ func resourceClusterEBSHashConfig(v interface{}) int { buf.WriteString(fmt.Sprintf("%d-", m["size"].(int))) buf.WriteString(fmt.Sprintf("%s-", m["type"].(string))) buf.WriteString(fmt.Sprintf("%d-", m["volumes_per_instance"].(int))) + if v, ok := m["throughput"].(int); ok && v != 0 { + buf.WriteString(fmt.Sprintf("%d-", v)) + } if v, ok := m["iops"].(int); ok && v != 0 { buf.WriteString(fmt.Sprintf("%d-", v)) } @@ -2092,6 +2111,9 @@ func expandEBSConfiguration(ebsConfigurations []interface{}) *emr.EbsConfigurati VolumeType: aws.String(cfg["type"].(string)), }, } + if v, ok := cfg["throughput"].(int); ok && v != 0 { + ebsBlockDeviceConfig.VolumeSpecification.Throughput = aws.Int64(int64(v)) + } if v, ok := cfg["iops"].(int); ok && v != 0 { ebsBlockDeviceConfig.VolumeSpecification.Iops = aws.Int64(int64(v)) } diff --git a/internal/service/emr/cluster_test.go b/internal/service/emr/cluster_test.go index 2cc99e6a692..7a44c88ea02 100644 --- a/internal/service/emr/cluster_test.go +++ b/internal/service/emr/cluster_test.go @@ -3560,7 +3560,8 @@ resource "aws_emr_cluster" "test" { } ebs_config { size = 50 - type = "gp2" + throughput = 500 + type = "gp3" volumes_per_instance = %[2]d } } diff --git a/internal/service/emr/validate.go b/internal/service/emr/validate.go index 5ace0b95575..a4fdb8a9c3c 100644 --- a/internal/service/emr/validate.go +++ b/internal/service/emr/validate.go @@ -24,6 +24,7 @@ func validCustomAMIID(v interface{}, k string) (ws []string, errors []error) { func validEBSVolumeType() schema.SchemaValidateFunc { return validation.StringInSlice([]string{ + "gp3", "gp2", "io1", "standard", diff --git a/website/docs/r/emr_cluster.html.markdown b/website/docs/r/emr_cluster.html.markdown index cc0d1c560e2..0309f2c9361 100644 --- a/website/docs/r/emr_cluster.html.markdown +++ b/website/docs/r/emr_cluster.html.markdown @@ -734,7 +734,8 @@ The launch specification for Spot instances in the fleet, which determines the d * `iops` - (Optional) Number of I/O operations per second (IOPS) that the volume supports. * `size` - (Required) Volume size, in gibibytes (GiB). -* `type` - (Required) Volume type. Valid options are `gp2`, `io1`, `standard` and `st1`. See [EBS Volume Types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html). +* `type` - (Required) Volume type. Valid options are `gp3`, `gp2`, `io1`, `standard` and `st1`. See [EBS Volume Types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html). +* `throughput` - (Optional) The throughput, in mebibyte per second (MiB/s). * `volumes_per_instance` - (Optional) Number of EBS volumes with this configuration to attach to each EC2 instance in the instance group (default is 1). ### ec2_attributes