cli icon indicating copy to clipboard operation
cli copied to clipboard

Introduce delete subcommand to `hcloud all`

Open kranurag7 opened this issue 1 year ago • 3 comments

TL;DR

As a User, I have the use case of deleting all the resources in one project in one go. Given we don't have projects API available in hcloud-go or project subcommand in hcloud CLI. I think we can implement it under hcloud all

Expected behavior

hcloud all delete 
< prompt: Do you really want to delete everything [y/n]? >

kranurag7 avatar Feb 06 '24 21:02 kranurag7

@apricote Do we want to implement it? If yes, I can give it an attempt.

I'm not very familiar with the code here so if you think that this will be not be possible to implement or requires some big refactoring then please let me know.

kranurag7 avatar Feb 19 '24 22:02 kranurag7

I'm not sure if it is a good idea to add this to the CLI, as this command is very dangerous and probably not that often used. Also it's not clear what should be deleted. All resources, even the free ones (like SSH Keys, Placement Groups and Firewalls)? Or only paid resources? How are protected resources handled? What about deletion order (Volumes might be attached to servers etc.)? Maybe we can get a third opinion on this.

For now I'd suggest a solution like this:

hcloud server list -o=noheader -o=columns=name | xargs -L1 -I{} hcloud server delete {}

phm07 avatar Mar 05 '24 11:03 phm07

With 3b896fef82f50bc27351eec9e2da38032615c6e0 being released, it is now easier to delete multiple resources at once.

I propose to let this feature request open and wait until enough user have expressed their interest to reconsider the implementation of such feature.

jooola avatar Apr 04 '24 12:04 jooola