-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up provider resource meta once done #132
Comments
Thanks for the labeling @apparentlymart |
This would be valuable to me as well. There are several actions my custom provider should take when terraform is done, but before it exits, such as remote close of client resources created during |
At present there is no way to do this. Once Terraform is finished with a provider, it just sends it a signal to shut it down. While on some platforms it would in principle be possible to intercept that signal and take some action based on it, I believe (IIRC) that on Windows there is no such opportunity, and so in practice this approach is not feasible. To address this would require a new RPC function between Terraform Core and the provider which can be used as an alternative to the signal-based approach used today. I believe we tried this during the v0.12 development cycle (while we were changing the plugin protocol anyway) but found some technical challenges that required further investigation. I don't have those details to hand right now, but hopefully we can dig them up in future when it's time to think about this problem some more. Our plugin protocol versioning strategy would allow this to be only a minor (non-breaking) protocol change if we implemented it as follows from the perspective of Terraform Core:
It's important to note that if this feature is implemented it should only be used for undoing any actions that were taken in |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi all,
What is the best way of closing resources in a provider after the provider end? Take for example a provider that uses a client that requires a
Close()
, I want to connect during configure and close at the end of the execution of the provider.Is there any prefered way? or introduce a
closeFn
at theschema.ProviderResource
sounds interesting?Thanks
The text was updated successfully, but these errors were encountered: