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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expression to read environment variables #545

Open
jamest-pin opened this issue Jan 11, 2024 · 5 comments
Open

Add expression to read environment variables #545

jamest-pin opened this issue Jan 11, 2024 · 5 comments
Labels
kind/enhancement Improvements or new features

Comments

@jamest-pin
Copy link

jamest-pin commented Jan 11, 2024

Hello!

  • Vote on this issue by adding a 馃憤 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Ability to access environment variables would be very handy. Would remove the need to have a wrapper script such as this

#!/bin/bash
pulumi stack select MYSTACK
pulumi config set myvar ${ENV_MYVAR:?}
...

Thanks!

Affected area/feature

Pulumi yaml

@jamest-pin jamest-pin added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Jan 11, 2024
@justinvp justinvp removed the needs-triage Needs attention from the triage team label Jan 17, 2024
@justinvp
Copy link
Member

Interesting idea. Thanks for the suggestion!

@Frassle
Copy link
Member

Frassle commented Jan 17, 2024

We've also considered adding envvar support to project defaults, see pulumi/pulumi#11547.

If we added that it might be enough not not require support in the YAML language directly.

@jamest-pin
Copy link
Author

We've also considered adding envvar support to project defaults, see pulumi/pulumi#11547.

If we added that it might be enough not not require support in the YAML language directly.

For my understanding, does 'envvar support' mean reading from a .env file? Would this mean we'd need to do things like adding a step to inject secrets from environment into local files in the CI/CD job? If yes, I feel it's cleaner to directly access variables in the yaml.

@AaronFriel
Copy link
Member

@jamest-pin I'm curious about your use case for injecting unique environment variables on subsequent executions. Is this something better served, perhaps, by automation API, deploying large numbers of similar stacks, or something else entirely?

@Frassle
Copy link
Member

Frassle commented Jan 18, 2024

For my understanding, does 'envvar support' mean reading from a .env file?

No. It means setting up something like:

config:
	address:
		env: TARGET_ADDRESS

The engine would fill in the "address" config value based on the value of the "TARGET_ADDRESS" envvar. So you'd need to set these config values in the Pulumi.yaml but you don't need extra .env files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

4 participants