provider/aws: Suceed deleting bucket policy on err (#9641)

If there is no bucket, a bucket policy can be counted as successfully
deleted.
This commit is contained in:
James Nugent 2016-10-26 17:16:54 -05:00 committed by Paul Stack
parent 68d865f46e
commit 54e4deb3e3
1 changed files with 3 additions and 0 deletions

View File

@ -100,6 +100,9 @@ func resourceAwsS3BucketPolicyDelete(d *schema.ResourceData, meta interface{}) e
})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "NoSuchBucket" {
return nil
}
return fmt.Errorf("Error deleting S3 policy: %s", err)
}