folks? my previous question. anyone, please?
# python
l
folks? my previous question. anyone, please?
i
no - we don’t have any way right now for you to hook into object lifecycles in that manner, unfortunately.
p
This relates to the “dynamic provider” that TS/JS has but Python doesn’t. One possibility is to register callbacks with the provider to run, but from what I can tell, the provider is running in a different python process than the user code. @incalculable-sundown-82514 correct me if I’m wrong, but my understanding is that the user code runs in an async function called by the constructor of the Stack object. While it runs, each call to a pulumi resource registers an RPC with the engine. The RPCs call the provider, which awaits each of the inputs. As each of the resource’s inputs resolve, the RPC completes. When all the RPCs have completed, the run has completed. So to hook in with the provider, we’d have to provide code that was not bound to any of the user variables, but could be bound to the RPC inputs/outputs.
The only way I’ve seen to “clean up” something that an “up” created and then was removed from the code is to delete it and then “pulumi refresh”.