As we don't have dynamic resource provides in .NET...
# dotnet
b
As we don't have dynamic resource provides in .NET, is there a way to detect when a stack is being destroyed? My scenario is that we've implemented a
CustomResource
that adds some database entries. I'd like to remove those entries if the resource is being destroyed. I'm pretty sure that the answer, if there is one, is that something will need to be executed outside of the
CustomResource
derived class.
I've looked at
Pulumi.Deployment.Instance
but that only has
IsDryRun
. Nothing to indicate if the stack is being destroyed.
b
If you use automation api you can subscribe to engine events and check for a delete/destroy action against a specific resource so that you can do something. But no, there is not a way to do this in your Pulumi program itself.
👍 1