Skip to content

Commit

Permalink
fix(cdb): [116078583]Fixed the problem of clienttoken duplication cau…
Browse files Browse the repository at this point in the history
…s… (#2549)

* fix(cdb):[116078583]Fixed the problem of clienttoken duplication caused by creation retry

* feat: add changelog
  • Loading branch information
gitmkn authored Mar 6, 2024
1 parent d9ebc41 commit 99a7b4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/2549.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_mysql_instance: Fixed the problem of clienttoken duplication caused by creation retry.
```
4 changes: 4 additions & 0 deletions tencentcloud/services/cdb/resource_tc_mysql_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 99a7b4d

Please sign in to comment.