Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3560.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_mysql_readonly_instance: optmize code logic
```
3 changes: 2 additions & 1 deletion tencentcloud/services/cdb/resource_tc_mysql_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func TencentMsyqlBasicInfo() map[string]*schema.Schema {
"cluster_topology": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "Cluster Edition node topology configuration. Note: If you purchased a cluster edition instance, this parameter is required. You need to set the RW and RO node topology of the cluster edition instance. The RO node range is 1-5. Please set at least 1 RO node.",
Elem: &schema.Resource{
Expand Down Expand Up @@ -325,7 +326,7 @@ func ResourceTencentCloudMysqlInstance() *schema.Resource {
Optional: true,
ValidateFunc: tccommon.ValidateAllowedIntValue([]int{0, 1}),
Default: 0,
Description: "Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones.",
Description: "Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones. Readonly instance settings are not supported.",
},
"first_slave_zone": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ func ResourceTencentCloudMysqlReadonlyInstance() *schema.Resource {

Importer: &schema.ResourceImporter{
State: helper.ImportWithDefaultValue(map[string]interface{}{
"prepaid_period": 1,
"force_delete": false,
"prepaid_period": 1,
"force_delete": false,
"slave_deploy_mode": 0,
}),
},
Schema: readonlyInstanceInfo,
Expand Down Expand Up @@ -410,6 +411,9 @@ func resourceTencentCloudMysqlReadonlyInstanceRead(d *schema.ResourceData, meta
_ = d.Set("ro_group_id", *roGroup.RoGroupId)
}

// set no used fields to default value to fix diff
_ = d.Set("slave_deploy_mode", 0)

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/mysql_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ If it is not specified, it defaults to a universal instance.
* `root_password` - (Optional, String) Password of root account. This parameter can be specified when you purchase master instances, but it should be ignored when you purchase read-only instances or disaster recovery instances.
* `second_slave_zone` - (Optional, String) Zone information about second slave instance.
* `security_groups` - (Optional, Set: [`String`]) Security groups to use.
* `slave_deploy_mode` - (Optional, Int) Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones.
* `slave_deploy_mode` - (Optional, Int) Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones. Readonly instance settings are not supported.
* `slave_sync_mode` - (Optional, Int) Data replication mode. 0 - Async replication; 1 - Semisync replication; 2 - Strongsync replication.
* `subnet_id` - (Optional, String) Private network ID. If `vpc_id` is set, this value is required.
* `tags` - (Optional, Map) Instance tags.
Expand Down
Loading