Skip to content

Commit

Permalink
Handle google_storage_bucket_object not being found (#14203)
Browse files Browse the repository at this point in the history
Mark the resource as no longer available.
  • Loading branch information
dasch authored and stack72 committed May 4, 2017
1 parent 9f7c539 commit 7a2f002
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions builtin/providers/google/resource_storage_bucket_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ func resourceStorageBucketObjectDelete(d *schema.ResourceData, meta interface{})
err := DeleteCall.Do()

if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 {
log.Printf("[WARN] Removing Bucket Object %q because it's gone", name)
// The resource doesn't exist anymore
d.SetId("")

return nil
}

return fmt.Errorf("Error deleting contents of object %s: %s", name, err)
}

Expand Down

0 comments on commit 7a2f002

Please sign in to comment.