https://pulumi.com logo
#automation-api
Title
# automation-api
b

big-state-95297

02/16/2022, 9:22 AM
Question about passing config values in automation api. All examples I could find only use
aws:region
which is not explicitly read by any inline programs. I'm trying to pass-in some config values that need to be read using
config.require(...)
method and when I run the automation api program using
npm run start
, I see the error:
Error: Program run without the Pulumi engine available; re-run using the pulumi CLI
. I see that the stack-trace points to the line where we try to do
const config = new pulumi.Config()
. Is there another way we should be reading the config values when running output pulumi CLI?
l

limited-rainbow-51650

02/16/2022, 10:25 AM
@big-state-95297 here is an example of an inline typescript automation program: https://github.com/pulumi/automation-api-examples/tree/main/nodejs/inlineProgram-tsnode In
index.ts
, starting line 15 is the function
pulumiProgram
creating the resources. Only within the body of this function you may use
const config = new pulumi.Config()
. This function is added to the Stack args on line 69. The args are then passed to the Pulumi Automation API on line 73. Additional stack config is added to it like on line 80. Does this help you?
On lines 95 and 96, you see how outputs are retrieved via the Automation API.
🙌 2
b

big-state-95297

02/16/2022, 11:25 PM
@limited-rainbow-51650: Thanks for the pointer. Looks like the way I had written my code would have executed the program code during stack initialization, which was causing this error.
2 Views