Skip to content

Commit

Permalink
Merge pull request #2497 from rgl/master
Browse files Browse the repository at this point in the history
provider/digitalocean: check if the droplet no longer exists.
  • Loading branch information
phinze committed Jun 26, 2015
2 parents ea7395f + 02791d7 commit c928d28
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
// Retrieve the droplet properties for updating the state
droplet, err := client.RetrieveDroplet(d.Id())
if err != nil {
// check if the droplet no longer exists.
if err.Error() == "Error retrieving droplet: API Error: 404 Not Found" {
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving droplet: %s", err)
}

Expand Down

0 comments on commit c928d28

Please sign in to comment.