From ef28f92dd34ce3fdbf62b6330d9ae6b4dd816316 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 11 Feb 2021 19:38:06 -0500 Subject: [PATCH] resource/s3_bucket_object: Check for timeout --- aws/internal/keyvaluetags/s3_tags.go | 4 ++++ aws/resource_aws_s3_bucket_object_test.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/aws/internal/keyvaluetags/s3_tags.go b/aws/internal/keyvaluetags/s3_tags.go index 995547b1c29..a858b48e51c 100644 --- a/aws/internal/keyvaluetags/s3_tags.go +++ b/aws/internal/keyvaluetags/s3_tags.go @@ -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. @@ -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 diff --git a/aws/resource_aws_s3_bucket_object_test.go b/aws/resource_aws_s3_bucket_object_test.go index de759a0d1d7..8201af3f769 100644 --- a/aws/resource_aws_s3_bucket_object_test.go +++ b/aws/resource_aws_s3_bucket_object_test.go @@ -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)