Skip to content

Commit

Permalink
Ignore 404s (#132)
Browse files Browse the repository at this point in the history
* Ignore 404s

* Add ApiClient ignore404

* Update provider/resource_frontegg_webhook.go

Co-authored-by: Nikhil Benesch <[email protected]>

---------

Co-authored-by: Nikhil Benesch <[email protected]>
  • Loading branch information
matthewarthur and benesch authored Jan 14, 2024
1 parent da7d237 commit f5a21c6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion provider/resource_frontegg_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,17 @@ func resourceFronteggWebhookUpdate(ctx context.Context, d *schema.ResourceData,

func resourceFronteggWebhookDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
clientHolder := meta.(*restclient.ClientHolder)
if err := clientHolder.PortalClient.Delete(ctx, fmt.Sprintf("%s/%s", fronteggWebhookPath, d.Id()), nil); err != nil {

// Configure the client to ignore 404 errors
clientHolder.PortalClient.Ignore404()

// Attempt to delete the webhook
err := clientHolder.PortalClient.Delete(ctx, fmt.Sprintf("%s/%s", fronteggWebhookPath, d.Id()), nil)

// Handle errors other than 404
if err != nil {
return diag.FromErr(err)
}

return nil
}

0 comments on commit f5a21c6

Please sign in to comment.