From e72d98572143bddc0818229a70ad51ddbff07668 Mon Sep 17 00:00:00 2001 From: arunma Date: Fri, 26 Jan 2024 09:56:51 +0800 Subject: [PATCH 1/2] fix: modify slaveDeployMode --- tencentcloud/services/cdb/resource_tc_mysql_instance.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tencentcloud/services/cdb/resource_tc_mysql_instance.go b/tencentcloud/services/cdb/resource_tc_mysql_instance.go index fa26613718..9da7393edf 100644 --- a/tencentcloud/services/cdb/resource_tc_mysql_instance.go +++ b/tencentcloud/services/cdb/resource_tc_mysql_instance.go @@ -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 := "" @@ -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 { From d5f9aafc1a86a3791332286839d84921063d46d5 Mon Sep 17 00:00:00 2001 From: arunma Date: Tue, 30 Jan 2024 19:32:16 +0800 Subject: [PATCH 2/2] feat: add changelog --- .changelog/2502.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/2502.txt diff --git a/.changelog/2502.txt b/.changelog/2502.txt new file mode 100644 index 0000000000..9c183c977a --- /dev/null +++ b/.changelog/2502.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_mysql_instance: Optimize the availability zone problem when modifying the configuration after active/standby switchover. +```