Thread
#automation-api
    b

    big-state-95297

    7 months ago
    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

    7 months ago
    @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.
    b

    big-state-95297

    7 months ago
    @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.