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
17 changes: 14 additions & 3 deletions tencentcloud/resource_tc_mysql_readonly_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ func resourceTencentCloudMysqlReadonlyInstance() *schema.Resource {
readonlyInstanceInfo := map[string]*schema.Schema{
"master_instance_id": {
Type: schema.TypeString,
ForceNew: true,
Required: true,
Description: "Indicates the master instance ID of recovery instances.",
},
"zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Description: "Zone information, this parameter defaults to, the system automatically selects an Availability Zone.",
},
"master_region": {
Type: schema.TypeString,
ForceNew: true,
Computed: true,
Optional: true,
Description: "The zone information of the primary instance is required when you purchase a disaster recovery instance.",
},
Expand Down Expand Up @@ -334,6 +333,18 @@ func resourceTencentCloudMysqlReadonlyInstanceUpdate(d *schema.ResourceData, met
return err
}

immutableFields := []string{
"master_instance_id",
"zone",
"master_region",
}

for _, f := range immutableFields {
if d.HasChange(f) {
return fmt.Errorf("argument `%s` cannot be modified for now", f)
}
}

d.Partial(false)

return resourceTencentCloudMysqlReadonlyInstanceRead(d, meta)
Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/mysql_readonly_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ resource "tencentcloud_mysql_readonly_instance" "default" {
The following arguments are supported:

* `instance_name` - (Required) The name of a mysql instance.
* `master_instance_id` - (Required, ForceNew) Indicates the master instance ID of recovery instances.
* `master_instance_id` - (Required) Indicates the master instance ID of recovery instances.
* `mem_size` - (Required) Memory size (in MB).
* `volume_size` - (Required) Disk size (in GB).
* `auto_renew_flag` - (Optional) Auto renew flag. NOTES: Only supported prepaid instance.
Expand All @@ -47,7 +47,7 @@ The following arguments are supported:
* `fast_upgrade` - (Optional) Specify whether to enable fast upgrade when upgrade instance spec, available value: `1` - enabled, `0` - disabled.
* `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.
* `intranet_port` - (Optional) Public access port. Valid value ranges: [1024~65535]. The default value is `3306`.
* `master_region` - (Optional, ForceNew) The zone information of the primary instance is required when you purchase a disaster recovery instance.
* `master_region` - (Optional) The zone information of the primary instance is required when you purchase a disaster recovery instance.
* `param_template_id` - (Optional) Specify parameter template id.
* `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.
* `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.
Expand All @@ -56,7 +56,7 @@ The following arguments are supported:
* `subnet_id` - (Optional) Private network ID. If `vpc_id` is set, this value is required.
* `tags` - (Optional) Instance tags.
* `vpc_id` - (Optional) ID of VPC, which can be modified once every 24 hours and can't be removed.
* `zone` - (Optional, ForceNew) Zone information, this parameter defaults to, the system automatically selects an Availability Zone.
* `zone` - (Optional) Zone information, this parameter defaults to, the system automatically selects an Availability Zone.

## Attributes Reference

Expand Down