diff --git a/.changelog/2549.txt b/.changelog/2549.txt new file mode 100644 index 0000000000..6c8c89bab3 --- /dev/null +++ b/.changelog/2549.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_mysql_instance: Fixed the problem of clienttoken duplication caused by creation retry. +``` \ No newline at end of file diff --git a/tencentcloud/services/cdb/resource_tc_mysql_instance.go b/tencentcloud/services/cdb/resource_tc_mysql_instance.go index f7349e7420..886e269cb8 100644 --- a/tencentcloud/services/cdb/resource_tc_mysql_instance.go +++ b/tencentcloud/services/cdb/resource_tc_mysql_instance.go @@ -570,6 +570,8 @@ func mysqlCreateInstancePayByMonth(ctx context.Context, d *schema.ResourceData, var response *cdb.CreateDBInstanceResponse err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { // shadowed response will not pass to outside + clientToken := helper.BuildToken() + request.ClientToken = &clientToken r, inErr := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseMysqlClient().CreateDBInstance(request) if inErr != nil { log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", @@ -621,6 +623,8 @@ func mysqlCreateInstancePayByUse(ctx context.Context, d *schema.ResourceData, me var response *cdb.CreateDBInstanceHourResponse err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { // shadowed response will not pass to outside + clientToken := helper.BuildToken() + request.ClientToken = &clientToken r, inErr := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseMysqlClient().CreateDBInstanceHour(request) if inErr != nil { return tccommon.RetryError(inErr)