Skip to content

Commit 602e39d

Browse files
tongyimingmikatong
andauthored
change replicas_read_only attribute (#1136)
* change replicas_read_only attribute * update doc Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 50d954b commit 602e39d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tencentcloud/resource_tc_redis_instance.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ func resourceTencentCloudRedisInstance() *schema.Resource {
165165
"replicas_read_only": {
166166
Type: schema.TypeBool,
167167
Optional: true,
168-
ForceNew: true,
169-
Default: false,
168+
Computed: true,
170169
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.",
171170
},
172171
"mem_size": {
@@ -298,7 +297,10 @@ func resourceTencentCloudRedisInstanceCreate(d *schema.ResourceData, meta interf
298297
chargeType := d.Get("charge_type").(string)
299298
autoRenewFlag := d.Get("auto_renew_flag").(int)
300299
chargeTypeID := REDIS_CHARGE_TYPE_ID[chargeType]
301-
replicasReadonly := d.Get("replicas_read_only").(bool)
300+
var replicasReadonly bool
301+
if v, ok := d.GetOk("replicas_read_only"); ok {
302+
replicasReadonly = v.(bool)
303+
}
302304
var chargePeriod uint64 = 1
303305
if chargeType == REDIS_CHARGE_TYPE_PREPAID {
304306
if period, ok := d.GetOk("prepaid_period"); ok {

website/docs/r/redis_instance.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The following arguments are supported:
8181
* `redis_replicas_num` - (Optional) The number of instance copies. This is not required for standalone and master slave versions.
8282
* `redis_shard_num` - (Optional) The number of instance shard, default is 1. This is not required for standalone and master slave versions.
8383
* `replica_zone_ids` - (Optional) ID of replica nodes available zone. This is not required for standalone and master slave versions.
84-
* `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.
84+
* `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.
8585
* `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.
8686
* `subnet_id` - (Optional, ForceNew) Specifies which subnet the instance should belong to.
8787
* `tags` - (Optional) Instance tags.

0 commit comments

Comments
 (0)