https://pulumi.com logo
Title
d

damp-honey-93158

04/28/2023, 1:38 AM
is it possible to ensure pulumi does not delete a stack if there are other stacks depending on it? (I’ve searched in slack already for pulumi destroy in a couple of ways and nothing relevant turned up).
l

little-cartoon-10569

04/28/2023, 1:50 AM
I don't think so. Stacks know which other stacks they depend on; they don't know which stack depend on them.
b

bored-activity-40468

04/28/2023, 3:26 AM
One option might be to use automation api.
d

damp-honey-93158

04/28/2023, 4:07 AM
I considered this - I know our guys have made the mistake of nuking a stack that was a dependancy…. not a pretty sight.
l

little-cartoon-10569

04/28/2023, 4:15 AM
Sounds like your permissions are... too permissive 😉
Stack deletion should require more than a simple PR!
p

prehistoric-plumber-4881

04/28/2023, 6:53 AM
In this case it was someone deleting a portion of their multi stack dev system.
e

echoing-dinner-19531

04/28/2023, 9:32 AM
I know @lemon-agent-27707 has spoke about getting the service to understand stack references better because it does have a global view of all stacks and so can say "this stack is used by other stacks so don't delete it". Worth raising an ask at https://github.com/pulumi/pulumi-cloud-requests/issues
l

lemon-agent-27707

04/28/2023, 2:45 PM
We do have an issue open add the concept of "protected stacks" similar to protected resources: https://github.com/pulumi/pulumi-cloud-requests/issues/48 Would you mind giving that a 👍 and adding a comment with any notes you might have?
b

bored-activity-40468

04/28/2023, 4:10 PM
Pulumi dung has an example of automation api with dependencies. So stand up stack A and it does B first then A. Destroy A and it destroys B first with approval prompts of course. Just automation api running over multiple stacks. https://github.com/gitfool/Pulumi.Dungeon