Hi Folks, I am trying create a simple program in p...
# automation-api
c
Hi Folks, I am trying create a simple program in python, that previews all the stacks in a given project, but I am running into trouble with the secretsprovider bits, any advice would be appreciated.
I keep getting this
Copy code
Traceback (most recent call last):
  File "main.py", line 26, in <module>
    stack.preview(on_output=print)
  File "/Users/ablum/.pyenv/versions/3.8.5/envs/autop/lib/python3.8/site-packages/pulumi/automation/_stack.py", line 342, in preview
    preview_result = self._run_pulumi_cmd_sync(args, on_output)
  File "/Users/ablum/.pyenv/versions/3.8.5/envs/autop/lib/python3.8/site-packages/pulumi/automation/_stack.py", line 591, in _run_pulumi_cmd_sync
    result = _run_pulumi_cmd(args, self.workspace.work_dir, envs, on_output)
  File "/Users/ablum/.pyenv/versions/3.8.5/envs/autop/lib/python3.8/site-packages/pulumi/automation/_cmd.py", line 75, in _run_pulumi_cmd
    raise create_command_error(result)
pulumi.automation.errors.CommandError: 
 code: 255
 stdout: 
 stderr: warning: A new version of Pulumi is available. To upgrade from version '3.1.0' to '3.2.1', run 
   $ brew upgrade pulumi
or visit <https://pulumi.com/docs/reference/install/> for manual instructions and release notes.
error: getting secrets manager: passphrase must be set with PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE environment variables
r
Can you show us some code? You’ll need to do what the error says (set the
PULUMI_CONFIG_PASSPHRASE
env var) in the LocalWorkspaceOptions
Something like this: https://github.com/pulumi/pulumi/blob/master/sdk/nodejs/tests/automation/localWorkspace.spec.ts#L461-L471 but in python Something like:
Copy code
ws = LocalWorkspace(project_settings=project_settings, env_vars={"PULUMI_CONFIG_PASSPHRASE": "secret"})
c
yep it looks like a case of me not providing env vars for my kms key
r
It’s possible you’re also running into a bug that was fixed in the CLI v3.2.1 so maybe try updating. Coz you shouldn’t need to set the env vars according to this example: https://github.com/pulumi/automation-api-examples/blob/main/python/inline_secrets_provider/main.py#L66-L83
c
yep that was the example I was cribbing. and yes i just updated just incase