-
Notifications
You must be signed in to change notification settings - Fork 2
Resource coderd_user
: Plan fails when user was deleted outside of terraform
#208
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
Comments
coderd_user
: Plan fails when user was deleted outside of terraform
Unlike all the other resources, it looks like we send a However, I can't reproduce your issue exactly. FWICT EDIT: This is just because I'm authorized as Owner. Not sure if that's by design, but it kinda makes sense. |
I'm using coder version 2.20.0 with coder provider version 2.3.0 and coder provider version 0.0.10 However, I might have misunderstood something. I didn't know that coder doesnt completely remove the just but just adds a deleted flag. In my case, I reset my database to have a fresh start as I broke some stuff and wanted to test a green-field-ish deployment. So the user actually was not in the database, but still in the terraform state |
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") ```
When a user created via the coderd provider is removed outside of terraform, the plan fails because it cannot find the user.
I would have expected the provider to mark this as deleted instead of running into an error
The text was updated successfully, but these errors were encountered: