I have different ESC environments for AWS defined ...
# aws
a
I have different ESC environments for AWS defined via OIDC. How can I access two of them within a single stack? If I was using a local aws credentials, I believe I could just define the two different AWS providers via a different profile option. But I dont see how to achieve this with ESC envs
s
You could import them into a single environment on the server side (in Pulumi Cloud), then re-map them to Pulumi Config as needed (since you can't have e.g. 2 AWS_ACCESS_KEY env vars): https://www.pulumi.com/docs/esc/environments/imports/
a
yeah i ended up doing two unique envs and for the one that gets used across multiple stacks creating a different set of env vars for and sticking it higher in the list. Then use the env vars in the aws.Provider.
s
It's a little cleaner if you output as
pulumiConfig
in the environment and then consume as required config in your program.
a
why would creating it as pulumi config somehow be simpler than env vars?
s
Because the config values are plugged directly into your program rather than having to reference env vars, which are system dependent. You likely do not need those env vars for other CLI actions - just the one Pulumi program that's running.
a
i'm very confused here. on the ESC env side you can define either envvar or config. This is a schema difference and one is not any more easy or difficult than the other. on the program side you can os.environ.get or pulumi.config.get. Why would one be more advantageous than the other?