This message was deleted.
# automation-api
s
This message was deleted.
p
Thanks for being my 🦆 . I think I see the problem - environment variables!
Hm. I thought I found away around the issue above by passing environment variables through to the
LocalWorkspaceOptions
interface like:
Copy code
const opts: LocalWorkspaceOptions = {
        secretsProvider: secretsProvider,
        envVars: {
            AWS_ACCESS_KEY_ID: credentials.Credentials!.AccessKeyId!,
            AWS_SECRET_ACCESS_KEY: credentials.Credentials!.SecretAccessKey!,
            AWS_SESSION_TOKEN: credentials.Credentials!.SessionToken!,
        },
where
credentials
is the output of an STS
AssumeRoleCommand
action. According to the docs, those environment variables should be passed to “every Pulumi command”. However, when the automation runs:
Copy code
const stack = await LocalWorkspace.createOrSelectStack(args, opts);
I get an access denied error on the bucket, which makes me think
createOrSelectStack
is not using the environment variables as expected (though I’m not sure how to prove this). If I set the process’ environment like I was originally (e.g.
process.env.AWS_ACCESS_KEY_ID = xxx
) immediately before the
createOrSelectStack
, it works as expected. Any thoughts on how I can get
createOrSelectStack
to honour the
envVars
set in the
opts
object?
b
I know this post is a month old now. Let me know if you already resolved this or opened an issue. I would call the above scenario a bug. Your future commands should be honoring the environment variables that you are setting in
opts
. If that is not happening as expected than I would open an issue on github for it, as that is how it is supposed to function.