Merge pull request #1576 from bitglue/s3_refresh

provider/aws: refresh state for deleted s3 bucket correctly
This commit is contained in:
Mitchell Hashimoto 2015-04-18 16:40:12 -07:00
commit 283a3af693
1 changed files with 7 additions and 1 deletions

View File

@ -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())