mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
providers/digitalocean: handle destroyed droplets
This commit is contained in:
parent
1cf62ddea5
commit
bcf92e8d39
@ -194,6 +194,11 @@ func resource_digitalocean_droplet_destroy(
|
|||||||
// Destroy the droplet
|
// Destroy the droplet
|
||||||
err := client.DestroyDroplet(s.ID)
|
err := client.DestroyDroplet(s.ID)
|
||||||
|
|
||||||
|
// Handle remotely destroyed droplets
|
||||||
|
if strings.Contains(err.Error(), "404 Not Found") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error deleting Droplet: %s", err)
|
return fmt.Errorf("Error deleting Droplet: %s", err)
|
||||||
}
|
}
|
||||||
@ -208,6 +213,12 @@ func resource_digitalocean_droplet_refresh(
|
|||||||
client := p.client
|
client := p.client
|
||||||
|
|
||||||
droplet, err := resource_digitalocean_droplet_retrieve(s.ID, client)
|
droplet, err := resource_digitalocean_droplet_retrieve(s.ID, client)
|
||||||
|
|
||||||
|
// Handle remotely destroyed droplets
|
||||||
|
if err != nil && strings.Contains(err.Error(), "404 Not Found") {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user