Skip to content

fix: handle user deletion config drift #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Apr 14, 2025

Closes #208.

Querying api/v2/users/{ID} returns a valid response for deleted users, as deleted users in coderd are merely tombstoned. To handle this, we perform an additional query by username. If the user has been deleted, the username will be available, or belong to a user with a different ID, in which case we can mark the user resource as deleted.

Also has the isNotFound check include the specific response for when a user does not exist:

sdkErr.StatusCode() == http.StatusBadRequest && strings.Contains(sdkErr.Message, "must be an existing uuid or username")

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ethanndickson ethanndickson marked this pull request as ready for review April 14, 2025 07:54
@ethanndickson ethanndickson self-assigned this Apr 14, 2025
@ethanndickson ethanndickson force-pushed the ethan/handle-user-deletion-drift branch from adc0503 to 24990cb Compare April 15, 2025 02:28
Copy link
Member Author

ethanndickson commented Apr 16, 2025

Merge activity

  • Apr 15, 9:28 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Apr 15, 9:29 PM EDT: A user merged this pull request with Graphite.

@ethanndickson ethanndickson merged commit 5503d71 into main Apr 16, 2025
14 checks passed
@ethanndickson ethanndickson deleted the ethan/handle-user-deletion-drift branch April 16, 2025 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resource coderd_user: Plan fails when user was deleted outside of terraform
2 participants