Skip to content

Commit c5e2f69

Browse files
authored
fix: modify slaveDeployMode (#2502)
* fix: modify slaveDeployMode * feat: add changelog
1 parent 30f9713 commit c5e2f69

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changelog/2502.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: Optimize the availability zone problem when modifying the configuration after active/standby switchover.
3+
```

tencentcloud/services/cdb/resource_tc_mysql_instance.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
10681068
memSize := int64(d.Get("mem_size").(int))
10691069
cpu := int64(d.Get("cpu").(int))
10701070
volumeSize := int64(d.Get("volume_size").(int))
1071-
slaveDeployMode := int64(d.Get("slave_deploy_mode").(int))
1071+
var slaveDeployMode int64 = -1
10721072
slaveSyncMode := int64(d.Get("slave_sync_mode").(int))
10731073
deviceType := ""
10741074
firstSlaveZone := ""
@@ -1095,6 +1095,12 @@ func mysqlAllInstanceRoleUpdate(ctx context.Context, d *schema.ResourceData, met
10951095
waitSwitch = int64(v.(int))
10961096
}
10971097

1098+
if d.HasChange("slave_deploy_mode") {
1099+
if v, ok := d.GetOkExists("slave_deploy_mode"); ok {
1100+
slaveDeployMode = int64(v.(int))
1101+
}
1102+
}
1103+
10981104
asyncRequestId, err := mysqlService.UpgradeDBInstance(ctx, d.Id(), memSize, cpu, volumeSize, fastUpgrade, deviceType, slaveDeployMode, slaveSyncMode, firstSlaveZone, secondSlaveZone, waitSwitch)
10991105

11001106
if err != nil {

0 commit comments

Comments
 (0)