Convert GP2 to GP3 with IOPS - TF ignores the iops

I have an ebs volume on gp2 that i want to now convert to gp3 with increased iops, I updated the volume as below but when applying i only get the conversion to gp3 not the iops increase, The gp2 volume currently has 9000 iops, but once i apply this, the conversion to gp3 decreases that to the gp3 default which is 3000

I then have to wait for 6 hours before i can run terraform again to change the iops, is there some way to make this on 1 run ?

resource “aws_ebs_volume” “Big_EBS_Volume” {
size = 3000
type = “gp2”

resource “aws_ebs_volume” “Big_EBS_Volume” {
size = 3000
type = “gp3”
iops = “9000”

here is the output :

# module.instance.aws_ebs_volume.Big_EBS_Volume[0] will be updated in-place
  ~ resource "aws_ebs_volume" "Big_EBS_Volume" {
        arn                  = "<ARN>"
        availability_zone    = "<AZ>"
        id                   = "<ID>"
        iops                 = 9000
        multi_attach_enabled = false
        size                 = 3000
        throughput           = 0
      ~ type                 = "gp2" -> "gp3"

as you can see only the type is changing.

BUT, if i change the iops to 9001 it makes both changes, so on a conversion from gp2 to gp3 terraform should note that the iops has been specified and that it should change that even if its the same as what the current iops are already

We are facing the exact same issue. This isn’t surprising given the fact that the parameter “iops” in only applies to gp2 so what have happened is terraform ignores this parameter when first converting from gp2 → gp3 forcing to re-apply the iops change after the gp3. The same is true for throughput parameter which is also applicable for gp3. There’s no easy fix even if you tried something like this in your TF resource code:

iops = (var.data_volume_type == “gp3” ? (var.data_volume_size >= 1000 ? var.gp3_iops : 3000) : null)
throughput = var.data_volume_type == “gp3” ? 250 : null

Note that CloudFormation is able to make this change in a single run though.

And also you will have to painfully wait for six or whatever hours it takes for the volume to complete OPTIMIZING before you can re-run the TF apply to increase the IOPs.