Skip to content

Commit

Permalink
Merge pull request #3768 from stack72/f-digitalocean-droplet-404
Browse files Browse the repository at this point in the history
provider/digitalocean: Fixing the DigitalOcean Droplet 404 potential on refresh of state
  • Loading branch information
catsby committed Nov 5, 2015
2 parents 99f3c05 + 6a811e2 commit c811dc9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
}

// Retrieve the droplet properties for updating the state
droplet, _, err := client.Droplets.Get(id)
droplet, resp, err := client.Droplets.Get(id)
if err != nil {
// check if the droplet no longer exists.
if err.Error() == "Error retrieving droplet: API Error: 404 Not Found" {
if resp.StatusCode == 404 {
log.Printf("[WARN] DigitalOcean Droplet (%s) not found", d.Id())
d.SetId("")
return nil
}
Expand Down

0 comments on commit c811dc9

Please sign in to comment.