diff --git a/tencentcloud/resource_tc_redis_instance.go b/tencentcloud/resource_tc_redis_instance.go index e1308c6f8c..c828b8f20f 100644 --- a/tencentcloud/resource_tc_redis_instance.go +++ b/tencentcloud/resource_tc_redis_instance.go @@ -165,8 +165,7 @@ func resourceTencentCloudRedisInstance() *schema.Resource { "replicas_read_only": { Type: schema.TypeBool, Optional: true, - ForceNew: true, - Default: false, + Computed: true, Description: "Whether copy read-only is supported, Redis 2.8 Standard Edition and CKV Standard Edition do not support replica read-only, turn on replica read-only, the instance will automatically read and write separate, write requests are routed to the primary node, read requests are routed to the replica node, if you need to open replica read-only, the recommended number of replicas >=2.", }, "mem_size": { @@ -298,7 +297,10 @@ func resourceTencentCloudRedisInstanceCreate(d *schema.ResourceData, meta interf chargeType := d.Get("charge_type").(string) autoRenewFlag := d.Get("auto_renew_flag").(int) chargeTypeID := REDIS_CHARGE_TYPE_ID[chargeType] - replicasReadonly := d.Get("replicas_read_only").(bool) + var replicasReadonly bool + if v, ok := d.GetOk("replicas_read_only"); ok { + replicasReadonly = v.(bool) + } var chargePeriod uint64 = 1 if chargeType == REDIS_CHARGE_TYPE_PREPAID { if period, ok := d.GetOk("prepaid_period"); ok { diff --git a/website/docs/r/redis_instance.html.markdown b/website/docs/r/redis_instance.html.markdown index 40db4946a8..a3a10c10f8 100644 --- a/website/docs/r/redis_instance.html.markdown +++ b/website/docs/r/redis_instance.html.markdown @@ -81,7 +81,7 @@ The following arguments are supported: * `redis_replicas_num` - (Optional) The number of instance copies. This is not required for standalone and master slave versions. * `redis_shard_num` - (Optional) The number of instance shard, default is 1. This is not required for standalone and master slave versions. * `replica_zone_ids` - (Optional) ID of replica nodes available zone. This is not required for standalone and master slave versions. -* `replicas_read_only` - (Optional, ForceNew) Whether copy read-only is supported, Redis 2.8 Standard Edition and CKV Standard Edition do not support replica read-only, turn on replica read-only, the instance will automatically read and write separate, write requests are routed to the primary node, read requests are routed to the replica node, if you need to open replica read-only, the recommended number of replicas >=2. +* `replicas_read_only` - (Optional) Whether copy read-only is supported, Redis 2.8 Standard Edition and CKV Standard Edition do not support replica read-only, turn on replica read-only, the instance will automatically read and write separate, write requests are routed to the primary node, read requests are routed to the replica node, if you need to open replica read-only, the recommended number of replicas >=2. * `security_groups` - (Optional, ForceNew) ID of security group. If both vpc_id and subnet_id are not set, this argument should not be set either. * `subnet_id` - (Optional, ForceNew) Specifies which subnet the instance should belong to. * `tags` - (Optional) Instance tags.