early-musician-41645
06/07/2019, 6:18 PMupdate
check if a scheduled pipeline already exists via the gitlab API, and if it doesn't then create one
- during destroy
check if a scheduled pipeline already exists via the gitlab API, and if it does then delete it
Is this reasonable? Is there a better approach for doing this?update
or a destroy
clever-sunset-76585
06/07/2019, 7:08 PMShort of writing my own Pulumi provider for the purpose, the gitlab REST API works great for this, so I thought perhaps there’s a way in pulumi to:
- duringcheck if a scheduled pipeline already exists via the gitlab API, and if it doesn’t then create oneupdate
- duringDo note, though, with a dynamic provider, it itself is bound by the rules of a resource lifecycle like any other resource. That means, its destroy/create/update functions are only called if thecheck if a scheduled pipeline already exists via the gitlab API, and if it does then delete itdestroy
diff
function indicates to the engine that there are changes and a replacement or a delete/create has to occur.
You could pass as inputs another resource’s properties, which could help your diff
function determine the correct action based on whether or not something changed in the dependent properties, i.e. trigger a delete/create when appropriate.