Skip to content

Commit

Permalink
resource/s3_bucket_object: Check for timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed Feb 12, 2021
1 parent 39a98e0 commit ef28f92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aws/internal/keyvaluetags/s3_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/hashicorp/aws-sdk-go-base/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
tfs3 "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/s3"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource"
)

// Custom S3 tag service update functions using the same format as generated code.
Expand Down Expand Up @@ -107,6 +108,9 @@ func S3ObjectListTags(conn *s3.S3, bucket, key string) (KeyValueTags, error) {

return nil
})
if tfresource.TimedOut(err) {
output, err = conn.GetObjectTagging(input)
}

if tfawserr.ErrCodeEquals(err, tfs3.ErrCodeNoSuchTagSet) {
return New(nil), nil
Expand Down
3 changes: 3 additions & 0 deletions aws/resource_aws_s3_bucket_object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,9 @@ func testAccCheckAWSS3BucketObjectExists(n string, obj *s3.GetObjectOutput) reso

return nil
})
if isResourceTimeoutError(err) {
out, err = s3conn.GetObject(input)
}

if err != nil {
return fmt.Errorf("S3Bucket Object error: %s", err)
Expand Down

0 comments on commit ef28f92

Please sign in to comment.