Skip to content

Commit

Permalink
load balancers: ignore 404 on delete.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething committed Nov 3, 2023
1 parent 4a61242 commit baccee0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion digitalocean/loadbalancer/resource_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"net/http"
"strings"
"time"

Expand Down Expand Up @@ -655,8 +656,13 @@ func resourceDigitalOceanLoadbalancerDelete(ctx context.Context, d *schema.Resou
client := meta.(*config.CombinedConfig).GodoClient()

log.Printf("[INFO] Deleting Load Balancer: %s", d.Id())
_, err := client.LoadBalancers.Delete(context.Background(), d.Id())
resp, err := client.LoadBalancers.Delete(context.Background(), d.Id())
if err != nil {
if resp != nil && resp.StatusCode == http.StatusNotFound {
d.SetId("")
return nil
}

return diag.Errorf("Error deleting Load Balancer: %s", err)
}

Expand Down

0 comments on commit baccee0

Please sign in to comment.