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/aws_s3_bucket: Retry on GetBucketTagging 404 Errors #13009

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
30 changes: 0 additions & 30 deletions aws/awserr.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package aws

import (
"errors"
"time"

"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/hashicorp/aws-sdk-go-base/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource"
Expand Down Expand Up @@ -38,31 +36,3 @@ func retryOnAwsCode(code string, f func() (interface{}, error)) (interface{}, er

return resp, err
}

// RetryOnAwsCodes retries AWS error codes for one minute
// Note: This function will be moved out of the aws package in the future.
func RetryOnAwsCodes(codes []string, f func() (interface{}, error)) (interface{}, error) {
var resp interface{}
err := resource.Retry(1*time.Minute, func() *resource.RetryError {
var err error
resp, err = f()
if err != nil {
var awsErr awserr.Error
if errors.As(err, &awsErr) {
for _, code := range codes {
if awsErr.Code() == code {
return resource.RetryableError(err)
}
}
}
return resource.NonRetryableError(err)
}
return nil
})

if tfresource.TimedOut(err) {
resp, err = f()
}

return resp, err
}