https://pulumi.com logo
#general
Title
# general
b

busy-magazine-6225

12/22/2021, 4:50 AM
I’d like to create a custom component resource that on creation performs some api calls and builds a thing on a website. If the calls are successful I’d like to publish an arbitrary resource in the pulumi state to track this resource. On pulumi destroy, or on destroy of the specific component resource, I’d like specific actions to be performed (An API call is executed to delete the resource, the arbitrary resource is deleted from pulumi state). Can anyone link me to some docs around handling the lifecycle of a custom component resource that’s built without using an already published provider? Lets say the class is called ClusterConnection, and it integrates my k8s cluster with a ci cd system by calling the cicd service’s API. I would have a clusterconnection resource in my pulumi state, and on destruction of that pulumi stack or resource it would perform a custom api call to delete the object and then it would remove the object from state
l

little-cartoon-10569

12/22/2021, 5:30 AM
This isn't what a custom component resource is for. To achieve these goals, you need to use a custom provider. Lifecycle and API calls are key "smells" that tell you that a provider is required.
b

busy-magazine-6225

12/22/2021, 7:11 AM
Awesome, thanks for the explanation and info
👍 1