mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
provider/digitalocean: check if the droplet no longer exists.
This commit is contained in:
parent
59fdc24d75
commit
02791d70df
@ -165,6 +165,12 @@ func resourceDigitalOceanDropletRead(d *schema.ResourceData, meta interface{}) e
|
|||||||
// Retrieve the droplet properties for updating the state
|
// Retrieve the droplet properties for updating the state
|
||||||
droplet, err := client.RetrieveDroplet(d.Id())
|
droplet, err := client.RetrieveDroplet(d.Id())
|
||||||
if err != nil {
|
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)
|
return fmt.Errorf("Error retrieving droplet: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user