Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read PULUMI_STACK, etc from env variables #13550

Open
bigluck opened this issue Jul 20, 2023 · 4 comments
Open

Read PULUMI_STACK, etc from env variables #13550

bigluck opened this issue Jul 20, 2023 · 4 comments
Labels
area/cli UX of using the CLI (args, output, logs) kind/enhancement Improvements or new features

Comments

@bigluck
Copy link

bigluck commented Jul 20, 2023

I would like to control the pulumi execution context using environment variables.

There are several use cases where it is more convenient to have a PULUMI_STACK=my/stack pulumi preview instead of pulumi preview -s my/stack.

In an advanced use case the pulumi execution context in a CI/CD can be controlled using environment variables without having to explicitly pass the value as an argument.

At the same time, this approach can be extended to a local development environment by using direnv and a custom hook that both activate the AWS session (using assume or any other 3rd party tools) and exports (by reading a .env file) the appropriate pulumi stack to use.

Looks like golang has some "kind" of support for some envs, but I wasn't able to trigger it using my cli

$ pulumi stack
Please choose a stack, or create a new one:  [Use arrows to move, type to filter]
  my/stack_1
  my/stack_2
> <create a new stack>
$ PULUMI_STACK=my/stack_1 pulumi preview
Please choose a stack, or create a new one:  [Use arrows to move, type to filter]
  my/stack_1
  my/stack_2
> <create a new stack>
$ pulumi preview -s my/stack_1
# it works!

Any suggest?

Thanks so much.
Luca

@bigluck bigluck added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Jul 20, 2023
@Frassle
Copy link
Member

Frassle commented Jul 21, 2023

Currently the only "global" place the current stack is pulled from is in ~/.pulumi/workspaces, but that's not easy to write to (the folder names are all hashed).

It doesn't seem unreasonable to allow some config like this to be environment rather than just by settings files.

@Frassle Frassle added area/cli UX of using the CLI (args, output, logs) and removed needs-triage Needs attention from the triage team labels Jul 21, 2023
@PierreBeucher
Copy link

Having a PULUMI_STACK environment would be very useful indeed, and would go nicely with PULUMI_CONFIG_PASSPHRASE to have tuple stack / passphrase

@olee
Copy link

olee commented Jan 25, 2024

I fully agree. I was really surprised to find out that PULUMI_STACK is not a thing yet as it would make building things like github workflows a lot easier.

@aloeenmae
Copy link

Still no updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli UX of using the CLI (args, output, logs) kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

5 participants