Merge pull request #8596 from hashicorp/librato-space-already-deleted

provider/librato: Refresh space from state when not found
This commit is contained in:
Paul Stack 2016-09-01 18:35:43 +01:00 committed by GitHub
commit 39875ebf65
1 changed files with 5 additions and 0 deletions

View File

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