Skip to content

Issue Deleting Abandoned Workspaces #7872

Closed
@baxters-ctc

Description

@baxters-ctc

In the process of moving from local users to OIDC, I ended up deleting and recreating a user. There were still workspaces attached to the user and I can't find a way to delete them.

When I access the workspace from the main Workspaces section in the UI I get this message -
"user" must be an existing uuid or username.

None of the typical UI items are visible including the delete button.

I tried recreating the username as a local user and now when I try to load the workspace it just redirects me back to the main Workspaces tab.

Is there any way to force delete these workspaces without going through the UI?

Activity

MrPeacockNLB

MrPeacockNLB commented on Jun 6, 2023

@MrPeacockNLB
Contributor

Did you try coder delete?

coder delete --orphan true -y WORKSPACE
baxters-ctc

baxters-ctc commented on Jun 6, 2023

@baxters-ctc
Author

@MrPeacockNLB Sorry I didn't catch that in the docs earlier. I tried running this and got an unexpected output -

coder delete --orphan true -y 2nd-test
wanted 1 args but got 2 [true 2nd-test]
coder delete --orphan true -y test-afs
wanted 1 args but got 2 [true test-afs]

If I run without the workspace arg it prompts but doesn't tell me what it's going to delete -

coder delete --orphan true 
> Confirm delete workspace? (yes/no) no

Any suggestions on how to proceed?

ammario

ammario commented on Jun 6, 2023

@ammario
Member

@baxters-ctc

--orphan by itself is all you need, so coder delete --orphan test-afs. The CLI doesn't know whether true is for the boolean flag or the name of the workspace.

added
waiting-for-infoThe issue creator is asked to provide more information.
on Jun 6, 2023
baxters-ctc

baxters-ctc commented on Jun 6, 2023

@baxters-ctc
Author

@ammario Thanks for following up and clarifying! I'm now running into a slightly different error . If I use just the workspace name, I get a "Resource not found or you do not have access to this resource -

coder delete --orphan -y 2nd-test
Resource not found or you do not have access to this resource

I'm a full admin on the coder instance so I expect I would have access. When I try to give the fully qualified username/workspace I get a different error that seems similar to what's shown the UI -

coder delete --orphan -y admin-somayira/2nd-test
"user" must be an existing uuid or username.

I was able to delete another workspace from that user's new OIDC account using the same fully qualified username/password format.

coder delete --orphan aldensomayire/terraform-upload

Confirm delete workspace? (yes/no) yes
✔ Queued [564ms]
✔ Setting up [28ms]
✔ Planning infrastructure [21ms]
⧗ Destroying workspace
The terraform state does not exist, there is nothing to do
✔ Destroying workspace [48ms]
✔ Cleaning Up [38ms]

The terraform-upload workspace has been deleted at Jun 6 23:43:06!

Any ideas why it doesn't work for the orphan case?

added
s2Broken use cases or features (with a workaround). Only humans may set this.
and removed
waiting-for-infoThe issue creator is asked to provide more information.
on Jun 7, 2023
ammario

ammario commented on Jun 9, 2023

@ammario
Member

Since this issues appears related to auth perhaps @Emyrk can assist.

added this to the ❓Sprint 1 milestone on Jun 12, 2023

10 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

s2Broken use cases or features (with a workaround). Only humans may set this.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Issue Deleting Abandoned Workspaces · Issue #7872 · coder/coder