When using `pulumi state delete` is there a way to...
# general
j
When using
pulumi state delete
is there a way to pass in multiple resources to delete from the state? Doing it one at a time is pretty slow.
b
No there isn't. Editing the state like this is something that you probably don't want to do regularly
j
Yeah unfortunately this comes from needing to migrate a lot of resources from Azure -> Azure Native. Which means deleting all the dependencies from the state before reimporting everything.....
And I'd rather avoid having to edit the state file directly
b
Ah of course
But no we don't have a way of removing more than one resource at a time
h
could you loop over it using your shell?
j
That's pretty much what I was doing @handsome-state-59775, but it takes maybe a minute or more each time. Not ideal on a couple hundred resources....
h
Copy code
for resource in "${resource_list[@]}"; do
    pulumi state delete "${resource}" -y &  # HOW ABOUT THIS?
done
wondering if concurrent deletes are safe... @brave-planet-10645?
b
That is a question I'm going to have to ask internally... BRB
Official answer is "wouldn't recommend it"
👍 1
j
Yeah not surprised with that at all, it shows it as an "Import" action in the webui when you run
pulumi state delete
so I imagine it's exporting the stack, modifying it and reimporting it? Doing that concurrently....nope.
b
Obviously you could run it not concurrently, but yes as you say if you've got a lot of resources it will take a while
j
Yeah in the end I exported the stack, edited it in vscode and reimported it. Preview is looking better but not upped it yet (Did find one case of accidentally deleting something that shouldn't have been, but it threw an error about that during import at least. Reinforces why I was trying to avoid manual state edits....)
Added some of these thoughts to the already open github issue about making Azure -> Azure Native migrations easier https://github.com/pulumi/pulumi/issues/6399