From e81d06d5051b9eccafe95cf75dedcb8e9ee08f61 Mon Sep 17 00:00:00 2001 From: Herkermer Sherwood Date: Thu, 15 Sep 2016 15:31:17 -0700 Subject: [PATCH] Remove If-Match check and update ETag in state based on HeadObject Fixes #4805 --- builtin/providers/aws/resource_aws_s3_bucket_object.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_s3_bucket_object.go b/builtin/providers/aws/resource_aws_s3_bucket_object.go index a44496736..b79453303 100644 --- a/builtin/providers/aws/resource_aws_s3_bucket_object.go +++ b/builtin/providers/aws/resource_aws_s3_bucket_object.go @@ -193,13 +193,11 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err bucket := d.Get("bucket").(string) key := d.Get("key").(string) - etag := d.Get("etag").(string) resp, err := s3conn.HeadObject( &s3.HeadObjectInput{ - Bucket: aws.String(bucket), - Key: aws.String(key), - IfMatch: aws.String(etag), + Bucket: aws.String(bucket), + Key: aws.String(key), }) if err != nil { @@ -220,6 +218,7 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err d.Set("content_type", resp.ContentType) d.Set("version_id", resp.VersionId) d.Set("kms_key_id", resp.SSEKMSKeyId) + d.Set("etag", strings.Trim(*resp.ETag, `"`)) // The "STANDARD" (which is also the default) storage // class when set would not be included in the results.