Skip to content

Commit 6691c38

Browse files
authored
Merge pull request #1892 from tencentcloudstack/feat/remove_mysql_forcenew
remove cdb forcenew
2 parents e7e702c + 366eacd commit 6691c38

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.changelog/1892.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_instance: adjust `slave_deploy_mode`, `first_slave_zone`, `second_slave_zone` and `slave_sync_mode` to unchangeable.
3+
```

tencentcloud/resource_tc_mysql_instance.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,26 +274,22 @@ func resourceTencentCloudMysqlInstance() *schema.Resource {
274274
"slave_deploy_mode": {
275275
Type: schema.TypeInt,
276276
Optional: true,
277-
ForceNew: true,
278277
ValidateFunc: validateAllowedIntValue([]int{0, 1}),
279278
Default: 0,
280279
Description: "Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones.",
281280
},
282281
"first_slave_zone": {
283282
Type: schema.TypeString,
284-
ForceNew: true,
285283
Optional: true,
286284
Description: "Zone information about first slave instance.",
287285
},
288286
"second_slave_zone": {
289287
Type: schema.TypeString,
290-
ForceNew: true,
291288
Optional: true,
292289
Description: "Zone information about second slave instance.",
293290
},
294291
"slave_sync_mode": {
295292
Type: schema.TypeInt,
296-
ForceNew: true,
297293
Optional: true,
298294
ValidateFunc: validateAllowedIntValue([]int{0, 1, 2}),
299295
Default: 0,
@@ -1331,6 +1327,16 @@ func resourceTencentCloudMysqlInstanceUpdate(d *schema.ResourceData, meta interf
13311327
logId := getLogId(contextNil)
13321328
ctx := context.WithValue(context.TODO(), logIdKey, logId)
13331329

1330+
immutableArgs := []string{
1331+
"slave_deploy_mode", "first_slave_zone", "second_slave_zone", "slave_sync_mode",
1332+
}
1333+
1334+
for _, v := range immutableArgs {
1335+
if d.HasChange(v) {
1336+
return fmt.Errorf("argument `%s` cannot be changed", v)
1337+
}
1338+
}
1339+
13341340
payType := getPayType(d).(int)
13351341

13361342
d.Partial(true)

website/docs/r/mysql_instance.html.markdown

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The following arguments are supported:
6060
* `device_type` - (Optional, String) Specify device type, available values: `UNIVERSAL` (default), `EXCLUSIVE`, `BASIC`.
6161
* `engine_version` - (Optional, String, ForceNew) The version number of the database engine to use. Supported versions include 5.5/5.6/5.7/8.0, and default is 5.7.
6262
* `fast_upgrade` - (Optional, Int) Specify whether to enable fast upgrade when upgrade instance spec, available value: `1` - enabled, `0` - disabled.
63-
* `first_slave_zone` - (Optional, String, ForceNew) Zone information about first slave instance.
63+
* `first_slave_zone` - (Optional, String) Zone information about first slave instance.
6464
* `force_delete` - (Optional, Bool) Indicate whether to delete instance directly or not. Default is `false`. If set true, the instance will be deleted instead of staying recycle bin. Note: only works for `PREPAID` instance. When the main mysql instance set true, this para of the readonly mysql instance will not take effect.
6565
* `internet_service` - (Optional, Int) Indicates whether to enable the access to an instance from public network: 0 - No, 1 - Yes.
6666
* `intranet_port` - (Optional, Int) Public access port. Valid value ranges: [1024~65535]. The default value is `3306`.
@@ -71,10 +71,10 @@ The following arguments are supported:
7171
* `prepaid_period` - (Optional, Int) Period of instance. NOTES: Only supported prepaid instance.
7272
* `project_id` - (Optional, Int) Project ID, default value is 0.
7373
* `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.
74-
* `second_slave_zone` - (Optional, String, ForceNew) Zone information about second slave instance.
74+
* `second_slave_zone` - (Optional, String) Zone information about second slave instance.
7575
* `security_groups` - (Optional, Set: [`String`]) Security groups to use.
76-
* `slave_deploy_mode` - (Optional, Int, ForceNew) Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones.
77-
* `slave_sync_mode` - (Optional, Int, ForceNew) Data replication mode. 0 - Async replication; 1 - Semisync replication; 2 - Strongsync replication.
76+
* `slave_deploy_mode` - (Optional, Int) Availability zone deployment method. Available values: 0 - Single availability zone; 1 - Multiple availability zones.
77+
* `slave_sync_mode` - (Optional, Int) Data replication mode. 0 - Async replication; 1 - Semisync replication; 2 - Strongsync replication.
7878
* `subnet_id` - (Optional, String) Private network ID. If `vpc_id` is set, this value is required.
7979
* `tags` - (Optional, Map) Instance tags.
8080
* `vpc_id` - (Optional, String) ID of VPC, which can be modified once every 24 hours and can't be removed.

0 commit comments

Comments
 (0)