Skip to content

Commit 0ffccba

Browse files
authored
Merge pull request #596 from ChrisdeR/hotfix/cvm_cloud_disk_sold_out
fix bug that waiting 5 minutes when cloud disk sold out
2 parents f4c1540 + b355a4d commit 0ffccba

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
## 1.53.8 (Unreleased)
2+
3+
BUG FIXES:
4+
5+
* Resource `tencentcloud_instance` fix bug that waiting 5 minutes when cloud disk sold out.
6+
27
## 1.53.7 (March 10, 2021)
38

49
ENHANCEMENTS:

tencentcloud/extension_cvm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ const (
4848
CVM_IMAGE_LOGIN = "TRUE"
4949
CVM_IMAGE_LOGIN_NOT = "FALSE"
5050

51-
CVM_ZONE_NOT_SUPPORT_ERROR = "InvalidParameterValue.ZoneNotSupported"
51+
CVM_ZONE_NOT_SUPPORT_ERROR = "InvalidParameterValue.ZoneNotSupported"
52+
CVM_CLOUD_DISK_SOLD_OUT_ERROR = "ResourceInsufficient.CloudDiskSoldOut"
5253
)
5354

5455
var CVM_CHARGE_TYPE = []string{

tencentcloud/resource_tc_instance.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import (
8787
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
8888
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
8989
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
90+
sdkErrors "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
9091
cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
9192
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
9293
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/ratelimit"
@@ -599,6 +600,10 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
599600
if err != nil {
600601
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n",
601602
logId, request.GetAction(), request.ToJsonString(), err.Error())
603+
e, ok := err.(*sdkErrors.TencentCloudSDKError)
604+
if ok && e.Code == CVM_CLOUD_DISK_SOLD_OUT_ERROR {
605+
return resource.NonRetryableError(e)
606+
}
602607
return retryError(err)
603608
}
604609
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",

0 commit comments

Comments
 (0)