Merge pull request #1576 from bitglue/s3_refresh
provider/aws: refresh state for deleted s3 bucket correctly
This commit is contained in:
commit
283a3af693
|
@ -85,7 +85,13 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error {
|
|||
Bucket: aws.String(d.Id()),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
if awsError, ok := err.(aws.APIError); ok && awsError.StatusCode == 404 {
|
||||
d.SetId("")
|
||||
} else {
|
||||
// some of the AWS SDK's errors can be empty strings, so let's add
|
||||
// some additional context.
|
||||
return fmt.Errorf("error reading S3 bucket \"%s\": %#v", d.Id())
|
||||
}
|
||||
}
|
||||
|
||||
tagSet, err := getTagSetS3(s3conn, d.Id())
|
||||
|
|
Loading…
Reference in New Issue