Skip to content

Commit

Permalink
[fix] Ignore 404s when revoking permissions (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
ph-ph authored Sep 5, 2024
1 parent 89e3728 commit 5ad27f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/provider/permissions/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ func (r *permissionResource) revokePermission(ctx context.Context, subject permi
request := api.NewPermissionsRevokePostRequest(createNewAPIPermissionsSubject(subject), createNewAPIPermissionsObject(object))
_, httpResponse, err := r.client.PermissionsAPI.PermissionsRevokePost(ctx).PermissionsRevokePostRequest(*request).Execute()
if err != nil {
if httpResponse != nil && httpResponse.StatusCode == 404 {
// If the permission does not exist, we can ignore the error.
tflog.Info(ctx, "Permission not found", map[string]any{"id": permissionID})
return diags
}
diags.AddError(
"Error deleting permission",
"Could not delete permission with ID "+permissionID+": "+err.Error(),
Expand Down

0 comments on commit 5ad27f5

Please sign in to comment.