https://pulumi.com logo
#automation-api
Title
# automation-api
h

hundreds-receptionist-31352

11/06/2020, 11:36 AM
Hello, I'm trying to do my first steps with automation-api and following the example in https://github.com/pulumi/automation-api-examples/tree/main/nodejs/pulumiOverHttp-ts I got the problem with passphrase must be set with PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE environment variables even if I do: export PULUMI_CONFIG_PASSPHRASE="" curl --header "Content-Type: application/json" --request POST --data '{"id":"hello3","content":"hello world\n"}' http://localhost:1337/sites {"commandResult":{"stdout":"Created stack 'hello3'\n","stderr":"error: passphrase must be set with PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE environment variables\n","code":255},"name":"CommandError"} surely I'm making some mistakes but can't realize yet
f

faint-table-42725

11/06/2020, 2:15 PM
Is that environment variable set in the shell process that’s running the server? In what you’ve pasted above, it looks like you’re setting it in the shell where you’re running curl.
h

hundreds-receptionist-31352

11/06/2020, 3:26 PM
yes you are right, thanks!!
l

lemon-agent-27707

11/06/2020, 3:48 PM
@hundreds-receptionist-31352 you can also set these environment variables on the workspace. You should be able to do this at the time you create your stack. https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/x/automation/#LocalWorkspace-envVars Then every command will have them. But you will have to update all usages of LocalWorkspace.create/select stack, or anywhere that a LocalWorkspace is created. Those methods take an optional third parameter where you can set env vars on init: https://github.com/pulumi/automation-api-examples/blob/main/nodejs/pulumiOverHttp-ts/index.ts#L73
h

hundreds-receptionist-31352

11/06/2020, 5:45 PM
Thanks Evan, I'll take a look at that too