https://pulumi.com logo
c

clean-zoo-67541

08/22/2023, 9:31 AM
Hey, Does the Pulumi automation API propogate env vars from the shell running the wrapper program to the Pulumi CLI RPC? It seems like it might not? Is there a way to do this? e.g. create a workspace with the same env as the process creating the workspace? to give a simple example. If the user sets
AWS_PROFILE
and them runs main.go which runs Pulumi using the automation API, I want the program to run with that profile
best way I found to do this so far is to get the env vars with
os.Environ()
and insert them into the local workspace when creating it
s

salmon-account-74572

08/22/2023, 9:24 PM
That’s the same technique I use; I don’t know if there’s a “better” way of doing it.
c

clean-zoo-67541

08/27/2023, 4:20 PM
Thanks, I can't get it to see the configuration set (in a file) by
gcloud config set
. Do you know of a solution for that?
s

salmon-account-74572

08/28/2023, 2:30 PM
I don’t know of a solution other than to
os.Exec
the
gcloud
command you need and parse the output, which is a hack at best but might work.
c

clean-zoo-67541

08/28/2023, 2:30 PM
thanks! that's what I implemented 🙂
s

salmon-account-74572

08/28/2023, 2:30 PM
LOL 😄