Hi everyone! Is it possible to prevent one stack f...
# general
b
Hi everyone! Is it possible to prevent one stack from getting destroyed as long as another stack is up? E.g. I have stack A which creates an EKS cluster and stack B for creating k8s resources in the cluster. Destroying stack A when stack B is still up leaves that stack in a bad state. And more worse, there may be unattended resources left that are not under Pulumi's control at all, e.g. load balancers that have been created by the load balancer manager. Can stack B register itself in stack A so that stack A can't be destroyed until stack B deregisters itself on its own destruction?
👍 1
l
Not out of the box. You can make specific resources safe from destroyed by setting the protect opt to true, but that's it.
You could write a dynamic provider that adds the protect opt to every resource based on a stack export from another stack...
That would require you to up your stack A before and after stack B.. but it would work (I think).
Another option would be to wrap your stack-A Pulumi program in automation-api, which checks for stack B and prevents deletes. That would be much easier.