From df4ccb6ada23f22526d7ae5e6a6caa30373ccf44 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 8 Sep 2023 09:56:26 -0400 Subject: [PATCH 1/3] r/aws_db_instance_automated_backups_replication: Guard against status code capitalization changes. --- .../rds/instance_automated_backups_replication.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/service/rds/instance_automated_backups_replication.go b/internal/service/rds/instance_automated_backups_replication.go index 8f07da3b131..8643e947114 100644 --- a/internal/service/rds/instance_automated_backups_replication.go +++ b/internal/service/rds/instance_automated_backups_replication.go @@ -7,6 +7,7 @@ import ( "context" "log" "strconv" + "strings" "time" "github.com/aws/aws-sdk-go/aws" @@ -23,10 +24,11 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/verify" ) +// AWS flip-flop on the capitalization of status codes. Use uppercase. const ( - InstanceAutomatedBackupStatusPending = "Pending" - InstanceAutomatedBackupStatusReplicating = "Replicating" - InstanceAutomatedBackupStatusRetained = "Retained" + InstanceAutomatedBackupStatusPending = "PENDING" + InstanceAutomatedBackupStatusReplicating = "REPLICATING" + InstanceAutomatedBackupStatusRetained = "RETAINED" ) // @SDKResource("aws_db_instance_automated_backups_replication") @@ -189,7 +191,8 @@ func FindDBInstanceAutomatedBackupByARN(ctx context.Context, conn *rds.RDS, arn return nil, err } - if status := aws.StringValue(output.Status); status == InstanceAutomatedBackupStatusRetained { + // AWS flip-flop on the capitalization of status codes. Case-insensitive comparison. + if status := aws.StringValue(output.Status); strings.EqualFold(status, InstanceAutomatedBackupStatusRetained) { // If the automated backup is retained, the replication is stopped. return nil, &retry.NotFoundError{ Message: status, @@ -260,7 +263,8 @@ func statusDBInstanceAutomatedBackup(ctx context.Context, conn *rds.RDS, arn str return nil, "", err } - return output, aws.StringValue(output.Status), nil + // AWS flip-flop on the capitalization of status codes. Convert to uppercase. + return output, strings.ToUpper(aws.StringValue(output.Status)), nil } } From f798b75305a3614932754cce62a0f60c5d37fae1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 8 Sep 2023 09:58:16 -0400 Subject: [PATCH 2/3] Add CHANGELOG entry. --- .changelog/#####.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/#####.txt diff --git a/.changelog/#####.txt b/.changelog/#####.txt new file mode 100644 index 00000000000..e5668083f6c --- /dev/null +++ b/.changelog/#####.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_redshift_cluster: Fix `unexpected state` errors on resource Create +``` \ No newline at end of file From 612fcd727c72c48022886990c139aa9da265716b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 8 Sep 2023 10:00:34 -0400 Subject: [PATCH 3/3] Correct CHANGELOG entry file name. --- .changelog/{#####.txt => 33369.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changelog/{#####.txt => 33369.txt} (100%) diff --git a/.changelog/#####.txt b/.changelog/33369.txt similarity index 100% rename from .changelog/#####.txt rename to .changelog/33369.txt