Remove If-Match check and update ETag in state based on HeadObject
Fixes #4805
This commit is contained in:
parent
2da49d30fd
commit
e81d06d505
|
@ -193,13 +193,11 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err
|
||||||
|
|
||||||
bucket := d.Get("bucket").(string)
|
bucket := d.Get("bucket").(string)
|
||||||
key := d.Get("key").(string)
|
key := d.Get("key").(string)
|
||||||
etag := d.Get("etag").(string)
|
|
||||||
|
|
||||||
resp, err := s3conn.HeadObject(
|
resp, err := s3conn.HeadObject(
|
||||||
&s3.HeadObjectInput{
|
&s3.HeadObjectInput{
|
||||||
Bucket: aws.String(bucket),
|
Bucket: aws.String(bucket),
|
||||||
Key: aws.String(key),
|
Key: aws.String(key),
|
||||||
IfMatch: aws.String(etag),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -220,6 +218,7 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err
|
||||||
d.Set("content_type", resp.ContentType)
|
d.Set("content_type", resp.ContentType)
|
||||||
d.Set("version_id", resp.VersionId)
|
d.Set("version_id", resp.VersionId)
|
||||||
d.Set("kms_key_id", resp.SSEKMSKeyId)
|
d.Set("kms_key_id", resp.SSEKMSKeyId)
|
||||||
|
d.Set("etag", strings.Trim(*resp.ETag, `"`))
|
||||||
|
|
||||||
// The "STANDARD" (which is also the default) storage
|
// The "STANDARD" (which is also the default) storage
|
||||||
// class when set would not be included in the results.
|
// class when set would not be included in the results.
|
||||||
|
|
Loading…
Reference in New Issue