Merge pull request #2497 from rgl/master

provider/digitalocean: check if the droplet no longer exists.
This commit is contained in:
Paul Hinze 2015-06-26 09:29:07 -05:00
commit c928d2803c
1 changed files with 6 additions and 0 deletions

View File

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