Skip to content

Commit

Permalink
fix: modify slaveDeployMode (#2502)
Browse files Browse the repository at this point in the history
* fix: modify slaveDeployMode

* feat: add changelog
  • Loading branch information
gitmkn authored Jan 30, 2024
1 parent 30f9713 commit c5e2f69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/2502.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_mysql_instance: Optimize the availability zone problem when modifying the configuration after active/standby switchover.
```
8 changes: 7 additions & 1 deletion tencentcloud/services/cdb/resource_tc_mysql_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
memSize := int64(d.Get("mem_size").(int))
cpu := int64(d.Get("cpu").(int))
volumeSize := int64(d.Get("volume_size").(int))
slaveDeployMode := int64(d.Get("slave_deploy_mode").(int))
var slaveDeployMode int64 = -1
slaveSyncMode := int64(d.Get("slave_sync_mode").(int))
deviceType := ""
firstSlaveZone := ""
Expand All @@ -1095,6 +1095,12 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
waitSwitch = int64(v.(int))
}

if d.HasChange("slave_deploy_mode") {
if v, ok := d.GetOkExists("slave_deploy_mode"); ok {
slaveDeployMode = int64(v.(int))
}
}

asyncRequestId, err := mysqlService.UpgradeDBInstance(ctx, d.Id(), memSize, cpu, volumeSize, fastUpgrade, deviceType, slaveDeployMode, slaveSyncMode, firstSlaveZone, secondSlaveZone, waitSwitch)

if err != nil {
Expand Down

0 comments on commit c5e2f69

Please sign in to comment.