https://pulumi.com logo
#general
Title
# general
t

thousands-honey-26696

03/22/2024, 6:53 PM
Or is there a way to access environment variables in your code instead the config values from the environment?
f

fast-sandwich-30809

03/22/2024, 7:00 PM
I have done horrible horrible things to environment variables. Node's process.env and Python's OS.environ should both work beautifully - what language are you using?
t

thousands-honey-26696

03/22/2024, 7:02 PM
Python. Sorry “environment” might be confusing. I’m referring to the pulumi esc https://www.pulumi.com/docs/esc/
s

salmon-account-74572

03/22/2024, 7:42 PM
That will depend on your ESC configuration, I'd say. Generally, you'd use the
pulumiConfig
option in the ESC definition, which means you have to pull them from the Pulumi configuration.
ESC can expose environment information as environment variables, but that doesn't integrate directly with the
pulumi
CLI (you end up having to do
esc run pulumi <operation>
I believe).
t

thousands-honey-26696

03/22/2024, 9:28 PM
Right. I am doing something like
client_id = config.require("azure_client_id")
but the client id doesn’t change from stack to stack. However I need to reference it in the code. I saw a PR on github. Maybe it’ll come one day.
s

salmon-account-74572

03/22/2024, 9:30 PM
I might be missing something here. You can do what you're describing with ESC and the
pulumiConfig
keyword today, using exactly the code you've shared above. Is this not working for you?
t

thousands-honey-26696

03/22/2024, 9:46 PM
No it totally works. What I want to do is set the environment in the Pulumi.yaml file instead of the Pulumi.stackname.yaml file.
s

salmon-account-74572

03/22/2024, 9:50 PM
Ah. Yeah, you can't do that yet, AFAIK.