diff --git a/.changelog/40601.txt b/.changelog/40601.txt new file mode 100644 index 00000000000..bff9ae86519 --- /dev/null +++ b/.changelog/40601.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_rds_cluster: Fix issue with waiter when modifying `allocated_storage` +``` \ No newline at end of file diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go index fd93671c274..11ace2a5d15 100644 --- a/internal/service/rds/cluster.go +++ b/internal/service/rds/cluster.go @@ -2050,6 +2050,7 @@ func waitDBClusterUpdated(ctx context.Context, conn *rds.Client, id string, wait clusterStatusRenaming, clusterStatusResettingMasterCredentials, clusterStatusScalingCompute, + clusterStatusScalingStorage, clusterStatusUpgrading, } if waitNoPendingModifiedValues { diff --git a/internal/service/rds/cluster_test.go b/internal/service/rds/cluster_test.go index d17a56a207d..4b56ab0d4a9 100644 --- a/internal/service/rds/cluster_test.go +++ b/internal/service/rds/cluster_test.go @@ -729,7 +729,7 @@ func TestAccRDSCluster_storageTypeAuroraUpdateAuroraIopt1(t *testing.T) { }) } -func TestAccRDSCluster_allocatedStorage(t *testing.T) { +func TestAccRDSCluster_allocatedStorage_io1(t *testing.T) { if testing.Short() { t.Skip("skipping long-running test in short mode") } @@ -746,7 +746,7 @@ func TestAccRDSCluster_allocatedStorage(t *testing.T) { CheckDestroy: testAccCheckClusterDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccClusterConfig_allocatedStorage(rName), + Config: testAccClusterConfig_allocatedStorage(rName, "io1", 100, 1000), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster), resource.TestCheckResourceAttr(resourceName, names.AttrAllocatedStorage, "100"), @@ -756,6 +756,40 @@ func TestAccRDSCluster_allocatedStorage(t *testing.T) { }) } +func TestAccRDSCluster_allocatedStorage_gp3(t *testing.T) { + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + ctx := acctest.Context(t) + var dbCluster types.DBCluster + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_rds_cluster.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.RDSServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckClusterDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccClusterConfig_allocatedStorage(rName, "gp3", 400, 12000), + Check: resource.ComposeTestCheckFunc( + testAccCheckClusterExists(ctx, resourceName, &dbCluster), + resource.TestCheckResourceAttr(resourceName, names.AttrAllocatedStorage, "400"), + ), + }, + { + Config: testAccClusterConfig_allocatedStorage(rName, "gp3", 500, 12000), + Check: resource.ComposeTestCheckFunc( + testAccCheckClusterExists(ctx, resourceName, &dbCluster), + resource.TestCheckResourceAttr(resourceName, names.AttrAllocatedStorage, "500"), + ), + }, + }, + }) +} + // Verify storage_type from aurora-iopt1 to aurora func TestAccRDSCluster_storageTypeAuroraIopt1UpdateAurora(t *testing.T) { if testing.Short() { @@ -3669,7 +3703,7 @@ resource "aws_db_instance" "test" { `, tfrds.ClusterEnginePostgres, mainInstanceClasses, rName, sType)) } -func testAccClusterConfig_allocatedStorage(rName string) string { +func testAccClusterConfig_allocatedStorage(rName, storageType string, allocatedStorage, iops int) string { return acctest.ConfigCompose( testAccConfig_ClusterSubnetGroup(rName), fmt.Sprintf(` @@ -3677,7 +3711,7 @@ data "aws_rds_orderable_db_instance" "test" { engine = %[1]q engine_latest_version = true preferred_instance_classes = [%[2]s] - storage_type = "io1" + storage_type = %[4]q supports_iops = true supports_clusters = true } @@ -3690,13 +3724,13 @@ resource "aws_rds_cluster" "test" { engine = data.aws_rds_orderable_db_instance.test.engine engine_version = data.aws_rds_orderable_db_instance.test.engine_version storage_type = data.aws_rds_orderable_db_instance.test.storage_type - allocated_storage = 100 - iops = 1000 + allocated_storage = %[5]d + iops = %[6]d master_password = "mustbeeightcharaters" master_username = "test" skip_final_snapshot = true } -`, tfrds.ClusterEngineMySQL, mainInstanceClasses, rName)) +`, tfrds.ClusterEngineMySQL, mainInstanceClasses, rName, storageType, allocatedStorage, iops)) } func testAccClusterConfig_iops(rName string) string { diff --git a/internal/service/rds/consts.go b/internal/service/rds/consts.go index 9fdd7c5e0ea..1393f9dc42f 100644 --- a/internal/service/rds/consts.go +++ b/internal/service/rds/consts.go @@ -30,6 +30,7 @@ const ( clusterStatusRenaming = "renaming" clusterStatusResettingMasterCredentials = "resetting-master-credentials" clusterStatusScalingCompute = "scaling-compute" + clusterStatusScalingStorage = "scaling-storage" clusterStatusUpgrading = "upgrading" // Non-standard status values.