Skip to content

fix(cynosdb): [132582949] tencentcloud_cynosdb_cluster suppor password modification #2968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2024
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/2968.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_cynosdb_cluster: suppor `password` modification
```
1 change: 0 additions & 1 deletion tencentcloud/services/cynosdb/extension_cynosdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ func TencentCynosdbClusterBaseInfo() map[string]*schema.Schema {
"password": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Sensitive: true,
Description: "Password of `root` account.",
},
Expand Down
20 changes: 20 additions & 0 deletions tencentcloud/services/cynosdb/resource_tc_cynosdb_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,26 @@ func resourceTencentCloudCynosdbClusterUpdate(d *schema.ResourceData, meta inter
}
}

// update root pwd
if d.HasChange("password") {
request := cynosdb.NewResetAccountPasswordRequest()
request.ClusterId = helper.String(clusterId)
request.AccountName = helper.String("root")
request.AccountPassword = helper.String(d.Get("password").(string))
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
_, err := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseCynosdbClient().ResetAccountPassword(request)
if err != nil {
return tccommon.RetryError(err)
}

return nil
})

if err != nil {
return err
}
}

// update tags
if d.HasChange("tags") {
oldTags, newTags := d.GetChange("tags")
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/cynosdb_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ The following arguments are supported:
* `cluster_name` - (Required, String) Name of CynosDB cluster.
* `db_type` - (Required, String, ForceNew) Type of CynosDB, and available values include `MYSQL`.
* `db_version` - (Required, String, ForceNew) Version of CynosDB, which is related to `db_type`. For `MYSQL`, available value is `5.7`, `8.0`.
* `password` - (Required, String, ForceNew) Password of `root` account.
* `password` - (Required, String) Password of `root` account.
* `subnet_id` - (Required, String) ID of the subnet within this VPC.
* `vpc_id` - (Required, String) ID of the VPC.
* `auto_pause_delay` - (Optional, Int) Specify auto-pause delay in second while `db_mode` is `SERVERLESS`. Value range: `[600, 691200]`. Default: `600`.
Expand Down
Loading