diff --git a/.changelog/31886.txt b/.changelog/31886.txt new file mode 100644 index 00000000000..dc929d42934 --- /dev/null +++ b/.changelog/31886.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_redshift_cluster: Allow `availability_zone_relocation_enabled` to be `true` when `publicly_accessible` is `true` +``` diff --git a/internal/service/redshift/cluster.go b/internal/service/redshift/cluster.go index 5d3537dd5c6..9a130774116 100644 --- a/internal/service/redshift/cluster.go +++ b/internal/service/redshift/cluster.go @@ -2,7 +2,6 @@ package redshift import ( "context" - "errors" "fmt" "log" "regexp" @@ -363,12 +362,6 @@ func ResourceCluster() *schema.Resource { CustomizeDiff: customdiff.All( verify.SetTagsDiff, - func(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - if diff.Get("availability_zone_relocation_enabled").(bool) && diff.Get("publicly_accessible").(bool) { - return errors.New("`availability_zone_relocation_enabled` cannot be true when `publicly_accessible` is true") - } - return nil - }, func(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { if diff.Id() == "" { return nil diff --git a/internal/service/redshift/cluster_test.go b/internal/service/redshift/cluster_test.go index 09cea46c91d..3bf6118b2b6 100644 --- a/internal/service/redshift/cluster_test.go +++ b/internal/service/redshift/cluster_test.go @@ -740,6 +740,8 @@ func TestAccRedshiftCluster_availabilityZoneRelocation(t *testing.T) { func TestAccRedshiftCluster_availabilityZoneRelocation_publiclyAccessible(t *testing.T) { ctx := acctest.Context(t) + var v redshift.Cluster + resourceName := "aws_redshift_cluster.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -749,8 +751,12 @@ func TestAccRedshiftCluster_availabilityZoneRelocation_publiclyAccessible(t *tes CheckDestroy: testAccCheckClusterDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccClusterConfig_availabilityZoneRelocationPubliclyAccessible(rName), - ExpectError: regexp.MustCompile("`availability_zone_relocation_enabled` cannot be true when `publicly_accessible` is true"), + Config: testAccClusterConfig_availabilityZoneRelocationPubliclyAccessible(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckClusterExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "availability_zone_relocation_enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + ), }, }, })