Remove If-Match check and update ETag in state based on HeadObject

Fixes #4805
This commit is contained in:
Herkermer Sherwood 2016-09-15 15:31:17 -07:00 committed by Clint
parent 2da49d30fd
commit e81d06d505
1 changed files with 3 additions and 4 deletions

View File

@ -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.