Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/alicloud_lindorm_instance: Added retry strategy for error code OperationDenied.OrderProcessing, Instance.IsNotValid #6997

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions alicloud/resource_alicloud_lindorm_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ func resourceAliCloudLindormInstanceUpdate(d *schema.ResourceData, meta interfac
err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError {
response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-15"), StringPointer("AK"), nil, request, &runtime)
if err != nil {
if IsExpectedErrors(err, []string{"Instance.NotActive"}) || NeedRetry(err) {
if IsExpectedErrors(err, []string{"Instance.IsNotValid"}) || NeedRetry(err) {
wait()
return resource.RetryableError(err)
}
Expand Down Expand Up @@ -674,7 +674,7 @@ func resourceAliCloudLindormInstanceUpdate(d *schema.ResourceData, meta interfac
err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError {
response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-15"), StringPointer("AK"), nil, updateLindormInstanceAttributeReq, &runtime)
if err != nil {
if IsExpectedErrors(err, []string{"Instance.NotActive"}) || NeedRetry(err) {
if IsExpectedErrors(err, []string{"Instance.IsNotValid"}) || NeedRetry(err) {
wait()
return resource.RetryableError(err)
}
Expand Down Expand Up @@ -1143,7 +1143,7 @@ func UpgradeLindormInstance(d *schema.ResourceData, meta interface{}, request ma
err = resource.Retry(client.GetRetryTimeout(d.Timeout(schema.TimeoutUpdate)), func() *resource.RetryError {
response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-06-15"), StringPointer("AK"), nil, request, &runtime)
if err != nil {
if IsExpectedErrors(err, []string{"Instance.NotActive"}) || NeedRetry(err) {
if IsExpectedErrors(err, []string{"Instance.NotActive", "OperationDenied.OrderProcessing"}) || NeedRetry(err) {
wait()
return resource.RetryableError(err)
}
Expand All @@ -1152,6 +1152,7 @@ func UpgradeLindormInstance(d *schema.ResourceData, meta interface{}, request ma
return nil
})
addDebug(action, response, request)

if err != nil {
return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR)
}
Expand All @@ -1161,5 +1162,6 @@ func UpgradeLindormInstance(d *schema.ResourceData, meta interface{}, request ma
if _, err := stateConf.WaitForState(); err != nil {
return WrapErrorf(err, IdMsg, d.Id())
}

return nil
}
11 changes: 5 additions & 6 deletions alicloud/resource_alicloud_lindorm_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,11 @@ func TestAccAliCloudLindormInstance_basic3(t *testing.T) {
}),
Check: resource.ComposeTestCheckFunc(
testAccCheck(map[string]string{
"disk_category": "local_ssd_pro",
"payment_type": "PayAsYouGo",
"instance_name": name,
"core_spec": "lindorm.i2.4xlarge",
"file_engine_specification": CHECKSET,
"instance_storage": CHECKSET,
"disk_category": "local_ssd_pro",
"payment_type": "PayAsYouGo",
"instance_name": name,
"core_spec": "lindorm.i2.4xlarge",
"instance_storage": CHECKSET,
}),
),
},
Expand Down