diff --git a/internal/service/memorydb/multi_region_cluster.go b/internal/service/memorydb/multi_region_cluster.go index 76a7c4620f96..126e114d0d7f 100644 --- a/internal/service/memorydb/multi_region_cluster.go +++ b/internal/service/memorydb/multi_region_cluster.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" @@ -131,7 +131,10 @@ func (r *multiRegionClusterResource) Schema(ctx context.Context, request resourc "tls_enabled": schema.BoolAttribute{ Optional: true, Computed: true, - Default: booldefault.StaticBool(true), + PlanModifiers: []planmodifier.Bool{ + boolplanmodifier.UseStateForUnknown(), + boolplanmodifier.RequiresReplace(), + }, }, "update_strategy": schema.StringAttribute{ Optional: true, diff --git a/internal/service/memorydb/multi_region_cluster_test.go b/internal/service/memorydb/multi_region_cluster_test.go index a5cd349eac27..4df3d1078371 100644 --- a/internal/service/memorydb/multi_region_cluster_test.go +++ b/internal/service/memorydb/multi_region_cluster_test.go @@ -119,10 +119,10 @@ func TestAccMemoryDBMultiRegionCluster_tlsEnabled(t *testing.T) { CheckDestroy: testAccCheckMultiRegionClusterDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccMultiRegionClusterConfig_tlsEnabled(rName), + Config: testAccMultiRegionClusterConfig_tlsEnabled(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckMultiRegionClusterExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "tls_enabled", acctest.CtFalse), + resource.TestCheckResourceAttr(resourceName, "tls_enabled", acctest.CtTrue), ), }, { @@ -130,6 +130,13 @@ func TestAccMemoryDBMultiRegionCluster_tlsEnabled(t *testing.T) { ImportState: true, ImportStateVerify: true, }, + { + Config: testAccMultiRegionClusterConfig_tlsEnabled(rName, false), + Check: resource.ComposeTestCheckFunc( + testAccCheckMultiRegionClusterExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tls_enabled", acctest.CtFalse), + ), + }, }, }) } @@ -473,14 +480,14 @@ resource "aws_memorydb_multi_region_cluster" "test" { `, rName) } -func testAccMultiRegionClusterConfig_tlsEnabled(rName string) string { +func testAccMultiRegionClusterConfig_tlsEnabled(rName string, tlsEnabled bool) string { return fmt.Sprintf(` resource "aws_memorydb_multi_region_cluster" "test" { multi_region_cluster_name_suffix = %[1]q node_type = "db.r7g.xlarge" - tls_enabled = false + tls_enabled = %[2]t } -`, rName) +`, rName, tlsEnabled) } func testAccMultiRegionClusterConfig_engine(rName, engine string) string { diff --git a/website/docs/r/memorydb_multi_region_cluster.html.markdown b/website/docs/r/memorydb_multi_region_cluster.html.markdown index 22d6111340da..19a448ff1edd 100644 --- a/website/docs/r/memorydb_multi_region_cluster.html.markdown +++ b/website/docs/r/memorydb_multi_region_cluster.html.markdown @@ -44,12 +44,12 @@ The following arguments are required: The following arguments are optional: * `description` - (Optional) description for the multi-region cluster. -* `engine` - (Optional) The name of the engine to be used for the multi-region cluster. Supported values are `redis` and `valkey`. +* `engine` - (Optional) The name of the engine to be used for the multi-region cluster. Valid values are `redis` and `valkey`. * `engine_version` - (Optional) The version of the engine to be used for the multi-region cluster. Downgrades are not supported. * `multi_region_parameter_group_name` - (Optional) The name of the multi-region parameter group to be associated with the cluster. * `num_shards` - (Optional) The number of shards for the multi-region cluster. * `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. -* `tls_enabled` - (Optional, Forces new resource) A flag to enable in-transit encryption on the cluster. Defaults to `true`. +* `tls_enabled` - (Optional, Forces new resource) A flag to enable in-transit encryption on the cluster. ## Attribute Reference