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

Retry app autoscaling policy create/update on ObjectNotFound error #8273

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions aws/resource_aws_appautoscaling_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,16 @@ func resourceAwsAppautoscalingPolicyCreate(d *schema.ResourceData, meta interfac
var err error
resp, err = conn.PutScalingPolicy(&params)
if err != nil {
if isAWSErr(err, "FailedResourceAccessException", "Rate exceeded") {
if isAWSErr(err, applicationautoscaling.ErrCodeFailedResourceAccessException, "Rate exceeded") {
return resource.RetryableError(err)
}
if isAWSErr(err, "FailedResourceAccessException", "is not authorized to perform") {
if isAWSErr(err, applicationautoscaling.ErrCodeFailedResourceAccessException, "is not authorized to perform") {
return resource.RetryableError(err)
}
if isAWSErr(err, "FailedResourceAccessException", "token included in the request is invalid") {
if isAWSErr(err, applicationautoscaling.ErrCodeFailedResourceAccessException, "token included in the request is invalid") {
return resource.RetryableError(err)
}
if isAWSErr(err, applicationautoscaling.ErrCodeObjectNotFoundException, "") {
return resource.RetryableError(err)
}
return resource.NonRetryableError(fmt.Errorf("Error putting scaling policy: %s", err))
Expand Down Expand Up @@ -343,6 +346,9 @@ func resourceAwsAppautoscalingPolicyUpdate(d *schema.ResourceData, meta interfac
if isAWSErr(err, applicationautoscaling.ErrCodeFailedResourceAccessException, "") {
return resource.RetryableError(err)
}
if isAWSErr(err, applicationautoscaling.ErrCodeObjectNotFoundException, "") {
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}
return nil
Expand Down