Skip to content

Commit

Permalink
Merge pull request #8596 from hashicorp/librato-space-already-deleted
Browse files Browse the repository at this point in the history
provider/librato: Refresh space from state when not found
  • Loading branch information
stack72 authored Sep 1, 2016
2 parents 438a612 + 4abfff2 commit 39875eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin/providers/librato/resource_librato_space.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ func resourceLibratoSpaceDelete(d *schema.ResourceData, meta interface{}) error
log.Printf("[INFO] Deleting Space: %d", id)
_, err = client.Spaces.Delete(uint(id))
if err != nil {
if errResp, ok := err.(*librato.ErrorResponse); ok && errResp.Response.StatusCode == 404 {
log.Printf("Space %s not found", d.Id())
d.SetId("")
return nil
}
return fmt.Errorf("Error deleting space: %s", err)
}

Expand Down

0 comments on commit 39875eb

Please sign in to comment.