Is there a resource like random that allows making...
# general
c
Is there a resource like random that allows making an API call as part of a pulumi stack and then durably storing the result for future runs?
m
You can use https://www.pulumi.com/registry/packages/command/api-docs/local/command/ for that. It’s not made specifically for API requests but you can run any command, including curl/wget/`az`/`aws` etc.
c
Thanks that appears to be a good solution.
m
NP. You might need to use the
triggers
property to control when it’s run.
c
Just to be clear, is the command rerun?
m
No, unless something changes - the command itself or a trigger.
The simplest use case for
local.Command
is to just run a command on
create
, which can return some value which will be stored in the state file, and will be persistent for the life of the stack (or until the resource is destroyed or replaced).
https://www.pulumi.com/registry/packages/command/
You can also use the standard Pulumi
dependsOn
to link it to other resources.
l
@calm-bear-55094 another option is the
purrl
provider: https://www.pulumi.com/registry/packages/purrl/