Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 70b69b9

Browse files
fix(cdb): [128074787] tencentcloud_mysql_readonly_instance optimize code logic (#3560)
* add * add * add * add
1 parent bf019b4 commit 70b69b9

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

‎.changelog/3560.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_mysql_readonly_instance: optmize code logic
3+
```

‎tencentcloud/services/cdb/resource_tc_mysql_instance.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ func TencentMsyqlBasicInfo() map[string]*schema.Schema {
182182
"cluster_topology": {
183183
Type: schema.TypeList,
184184
Optional: true,
185+
Computed: true,
185186
MaxItems: 1,
186187
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.",
187188
Elem: &schema.Resource{
@@ -325,7 +326,7 @@ func ResourceTencentCloudMysqlInstance() *schema.Resource {
325326
Optional: true,
326327
ValidateFunc: tccommon.ValidateAllowedIntValue([]int{0, 1}),
327328
Default: 0,
328-
Description: "Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones.",
329+
Description: "Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones. Readonly instance settings are not supported.",
329330
},
330331
"first_slave_zone": {
331332
Type: schema.TypeString,

‎tencentcloud/services/cdb/resource_tc_mysql_readonly_instance.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ func ResourceTencentCloudMysqlReadonlyInstance() *schema.Resource {
6464

6565
Importer: &schema.ResourceImporter{
6666
State: helper.ImportWithDefaultValue(map[string]interface{}{
67-
"prepaid_period": 1,
68-
"force_delete": false,
67+
"prepaid_period": 1,
68+
"force_delete": false,
69+
"slave_deploy_mode": 0,
6970
}),
7071
},
7172
Schema: readonlyInstanceInfo,
@@ -410,6 +411,9 @@ func resourceTencentCloudMysqlReadonlyInstanceRead(d *schema.ResourceData, meta
410411
_ = d.Set("ro_group_id", *roGroup.RoGroupId)
411412
}
412413

414+
// set no used fields to default value to fix diff
415+
_ = d.Set("slave_deploy_mode", 0)
416+
413417
return nil
414418
}
415419

‎website/docs/r/mysql_instance.html.markdown‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ If it is not specified, it defaults to a universal instance.
233233
* `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.
234234
* `second_slave_zone` - (Optional, String) Zone information about second slave instance.
235235
* `security_groups` - (Optional, Set: [`String`]) Security groups to use.
236-
* `slave_deploy_mode` - (Optional, Int) Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones.
236+
* `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.
237237
* `slave_sync_mode` - (Optional, Int) Data replication mode. 0 - Async replication; 1 - Semisync replication; 2 - Strongsync replication.
238238
* `subnet_id` - (Optional, String) Private network ID. If `vpc_id` is set, this value is required.
239239
* `tags` - (Optional, Map) Instance tags.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /