Hi, is it possible to rretrieve some of the `UpOpt...
# automation-api
Hi, is it possible to rretrieve some of the
from the called program? Or pass some data to the program?
Which upOptions are you trying to pass? In general, a pulumi program should generate the same manifest no matter the context. For configuration, you could read a config file from within the program and/or use environment variables
I have a data structure that contains AWS account. It contains the account ID and the region, so I would like to pass it to the pulumi program to avoid the need of using `aws.getCallerIdentity() methon inside the pulumi program
so basically, I run the pulumi program inside another typescript application that ensures the aws account and id and I would like to pass that informatio to the pulumi program
maybe what I should do is to create a config file? and then retrieve everything using
It looks like you're using typescript?
Get a little crazy with it and provide your pulumi driver with a closure 👀
Copy code
const program = (accountId: string) => {doTheThing()};
const makeProgram = (accountId: string) => () => program(accountId);

const myNowCustomizedProgram = makeProgram("1234");
looks like you got my idea, but I lack of knowledge in typescript. So what I have at this moment is that I export the
method of the index.ts of the pulumi project. I import it into another pulumi file where I pass it into the program parameter, like
program: main
This works well.
so, I'll try to understand better your sugestion and see if I can implement it, thanks!
For sure! With that in mind, maybe I can translate to es5:
Copy code
// --- In ./project/index.ts ---
// The main function may take arguments!
export function main(accountId, comment){
    // Code goes here
Copy code
// --- In the file putting it all together ---
import {main} from './project/index.ts';

var accountId = getAccountId(); // Get parameters however you need

function wrappedMain(){
    main(accountId, "Pass other parameters here");

    program: wrappedMain, // Pulumi doesn't need to know that main is wrapped ;)
This seems to be exactly what automation-api does for you. Would an inline program be the solution you're looking for? You can define one in a function and call it from any node app. Avoids re-implementing a wheel. https://www.pulumi.com/docs/using-pulumi/automation-api/concepts-terminology/#inline-program https://github.com/pulumi/automation-api-examples/tree/main/nodejs
The second link didn't show up very well.. here it is again. https://github.com/pulumi/automation-api-examples/tree/main/nodejs