Skip to content

Commit 402cf2d

Browse files
authored
fix: mysqlro - remove forcenew attribute (#1069)
1 parent 88a9383 commit 402cf2d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

tencentcloud/resource_tc_mysql_readonly_instance.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,18 @@ func resourceTencentCloudMysqlReadonlyInstance() *schema.Resource {
4141
readonlyInstanceInfo := map[string]*schema.Schema{
4242
"master_instance_id": {
4343
Type: schema.TypeString,
44-
ForceNew: true,
4544
Required: true,
4645
Description: "Indicates the master instance ID of recovery instances.",
4746
},
4847
"zone": {
4948
Type: schema.TypeString,
5049
Optional: true,
51-
ForceNew: true,
50+
Computed: true,
5251
Description: "Zone information, this parameter defaults to, the system automatically selects an Availability Zone.",
5352
},
5453
"master_region": {
5554
Type: schema.TypeString,
56-
ForceNew: true,
55+
Computed: true,
5756
Optional: true,
5857
Description: "The zone information of the primary instance is required when you purchase a disaster recovery instance.",
5958
},
@@ -334,6 +333,18 @@ func resourceTencentCloudMysqlReadonlyInstanceUpdate(d *schema.ResourceData, met
334333
return err
335334
}
336335

336+
immutableFields := []string{
337+
"master_instance_id",
338+
"zone",
339+
"master_region",
340+
}
341+
342+
for _, f := range immutableFields {
343+
if d.HasChange(f) {
344+
return fmt.Errorf("argument `%s` cannot be modified for now", f)
345+
}
346+
}
347+
337348
d.Partial(false)
338349

339350
return resourceTencentCloudMysqlReadonlyInstanceRead(d, meta)

website/docs/r/mysql_readonly_instance.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ resource "tencentcloud_mysql_readonly_instance" "default" {
3838
The following arguments are supported:
3939

4040
* `instance_name` - (Required) The name of a mysql instance.
41-
* `master_instance_id` - (Required, ForceNew) Indicates the master instance ID of recovery instances.
41+
* `master_instance_id` - (Required) Indicates the master instance ID of recovery instances.
4242
* `mem_size` - (Required) Memory size (in MB).
4343
* `volume_size` - (Required) Disk size (in GB).
4444
* `auto_renew_flag` - (Optional) Auto renew flag. NOTES: Only supported prepaid instance.
@@ -47,7 +47,7 @@ The following arguments are supported:
4747
* `fast_upgrade` - (Optional) Specify whether to enable fast upgrade when upgrade instance spec, available value: `1` - enabled, `0` - disabled.
4848
* `force_delete` - (Optional) 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.
4949
* `intranet_port` - (Optional) Public access port. Valid value ranges: [1024~65535]. The default value is `3306`.
50-
* `master_region` - (Optional, ForceNew) The zone information of the primary instance is required when you purchase a disaster recovery instance.
50+
* `master_region` - (Optional) The zone information of the primary instance is required when you purchase a disaster recovery instance.
5151
* `param_template_id` - (Optional) Specify parameter template id.
5252
* `pay_type` - (Optional, **Deprecated**) It has been deprecated from version 1.36.0. Please use `charge_type` instead. Pay type of instance. Valid values: `0`, `1`. `0`: prepaid, `1`: postpaid.
5353
* `period` - (Optional, **Deprecated**) It has been deprecated from version 1.36.0. Please use `prepaid_period` instead. Period of instance. NOTES: Only supported prepaid instance.
@@ -56,7 +56,7 @@ The following arguments are supported:
5656
* `subnet_id` - (Optional) Private network ID. If `vpc_id` is set, this value is required.
5757
* `tags` - (Optional) Instance tags.
5858
* `vpc_id` - (Optional) ID of VPC, which can be modified once every 24 hours and can't be removed.
59-
* `zone` - (Optional, ForceNew) Zone information, this parameter defaults to, the system automatically selects an Availability Zone.
59+
* `zone` - (Optional) Zone information, this parameter defaults to, the system automatically selects an Availability Zone.
6060

6161
## Attributes Reference
6262

0 commit comments

Comments
 (0)