provider/digitalocean: Refresh DO loadbalancer from state if 404 (#14897)
Fixes: #14852
This commit is contained in:
parent
3c8a19f65e
commit
f7996e36ea
|
@ -237,8 +237,13 @@ func resourceDigitalOceanLoadbalancerRead(d *schema.ResourceData, meta interface
|
||||||
client := meta.(*godo.Client)
|
client := meta.(*godo.Client)
|
||||||
|
|
||||||
log.Printf("[INFO] Reading the details of the Loadbalancer %s", d.Id())
|
log.Printf("[INFO] Reading the details of the Loadbalancer %s", d.Id())
|
||||||
loadbalancer, _, err := client.LoadBalancers.Get(context.Background(), d.Id())
|
loadbalancer, resp, err := client.LoadBalancers.Get(context.Background(), d.Id())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if resp != nil && resp.StatusCode == 404 {
|
||||||
|
log.Printf("[WARN] DigitalOcean Load Balancer (%s) not found", d.Id())
|
||||||
|
d.SetId("")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return fmt.Errorf("Error retrieving Loadbalancer: %s", err)
|
return fmt.Errorf("Error retrieving Loadbalancer: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue