Don't error out getting s3 object tags in govcloud

This commit is contained in:
Evan Phoenix 2017-05-09 15:39:58 -07:00
parent 8f810cdee0
commit 2171e2118f
1 changed files with 9 additions and 2 deletions

View File

@ -216,6 +216,8 @@ func resourceAwsS3BucketObjectPut(d *schema.ResourceData, meta interface{}) erro
func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) error {
s3conn := meta.(*AWSClient).s3conn
restricted := meta.(*AWSClient).IsGovCloud() || meta.(*AWSClient).IsChinaCloud()
bucket := d.Get("bucket").(string)
key := d.Get("key").(string)
@ -275,9 +277,14 @@ func resourceAwsS3BucketObjectRead(d *schema.ResourceData, meta interface{}) err
Key: aws.String(key),
})
if err != nil {
return fmt.Errorf("Failed to get object tags (bucket: %s, key: %s): %s", bucket, key, err)
// Treat the inability to get object tags in a restricted regions as a
// soft error.
if !restricted {
return err
}
} else {
d.Set("tags", tagsToMapS3(tagResp.TagSet))
}
d.Set("tags", tagsToMapS3(tagResp.TagSet))
return nil
}