Skip to content

Apply custom env vars to Automation API workspace#4

Open
jdavredbeard wants to merge 1 commit into
mainfrom
fix/apply-custom-env-vars
Open

Apply custom env vars to Automation API workspace#4
jdavredbeard wants to merge 1 commit into
mainfrom
fix/apply-custom-env-vars

Conversation

@jdavredbeard

Copy link
Copy Markdown
Collaborator

Summary

  • Fix env() option having no effect — custom env vars were stored in options.custom_env but never merged into _env_vars or passed to the Pulumi Automation API
  • Merge options.custom_env into _env_vars after defaults, so custom values take precedence
  • Pass env vars to both LocalWorkspace(env_vars=...) and create_or_select_stack(opts=LocalWorkspaceOptions(env_vars=...))

Without this fix, env("PULUMI_BACKEND_URL", "file:///tmp/backend") was silently ignored, causing stacks to use the ambient backend (e.g. Pulumi Cloud) instead of the requested file backend.

Test plan

  • Added test_custom_env_vars_applied verifying env vars flow through to workspace and stack creation
  • All 32 existing tests pass

🤖 Generated with Claude Code

The `env()` option was setting `options.custom_env` but those values were
never merged into `_env_vars` or passed to the Automation API. This meant
`env("PULUMI_BACKEND_URL", ...)` had no effect — the workspace would use
whatever backend was ambient, ignoring the caller's intent.

Now custom env vars are:
1. Merged into `_env_vars` (overriding defaults)
2. Passed to `LocalWorkspace(env_vars=...)`
3. Passed to `create_or_select_stack(opts=LocalWorkspaceOptions(env_vars=...))`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant