Hi, I would like to make a REST API call to an end...
# general
e
Hi, I would like to make a REST API call to an endpoint. I can use the language specific tools (ie for python, `requests`or
urllib
), but I would like pulumi to understand to make the API call only once on the first
pulumi up
. In other words is there a pulumi resource that make REST API call? Thanks
l
The first thing which comes to mind is Pulumi Dynamic Providers. The call which you want to do follows the resource lifecycle, where you can indicate that after the first call, there are “no changes”, so Pulumi will not “update the resource”. https://www.pulumi.com/docs/intro/concepts/resources/dynamic-providers/
👍 2
e
+1 to dynamic providers. We also have an issue tracking adding stateful actions to programs: https://github.com/pulumi/pulumi/issues/127 Idea being that for some simple things (like run this code once on update, but then just use the saved state) we can have something easier to work with and lighter-weight than dynamic providers.
👍 1
l
Pulumi's Automation API is amazing and enables you to use Python Requests. Examples here. It takes a bit of getting used to because the config doesn't support structured values all that well yet, but it's pretty easy to pass between scripts using YAML/JSON.
439 Views