https://pulumi.com logo
Title
c

clever-address-74879

06/06/2022, 12:32 PM
And get it with
var config = new Pulumi.Config();
var name = config.Require("ConnectionString");
e

echoing-dinner-19531

06/06/2022, 2:33 PM
Pulumi.Config
is for values you've set with
pulumi config
as part of your stack Pulumi.<stack name>.yaml file. It won't pick up env vars. Just use the standard
System.Environment
class to get env vars set by your CI system.
👍 1
c

clever-address-74879

06/06/2022, 4:56 PM
Thanks @echoing-dinner-19531. So the
pulumi.<stack-name>.yml
file is used for non-secret environment specific things?
d

damp-honey-93158

06/06/2022, 7:11 PM
No, it's used for secrets - but afaik, doesn't fall back to getting things from the environment.
w

worried-city-86458

06/06/2022, 7:19 PM
If using the automation api, you can also bypass pulumi config and use standard dotnet config sources, which could pick up config via environment variables too.
(That's what I do here)
e

echoing-dinner-19531

06/06/2022, 7:29 PM
for non-secret environment specific things? (edited)
As the others said you can put secrets in there (and if you tell pulumi it's a secret with --secret they will be encrypted). But it is it's own data source and has no relation to environment variables.
c

clever-address-74879

06/07/2022, 3:37 PM
So how do you get secrets in there in CI/CD? Replace a placeholder in the workflow/pipeline or something else? 🙂
e

echoing-dinner-19531

06/07/2022, 3:39 PM
Either get CI/CD to set it via
pulumi config
or don't read those secrets from the pulumi config but grab them out of the environment variable that CI put it in.
✅ 1
c

clever-address-74879

06/07/2022, 3:40 PM
Right, that was what I was getting at 🙂 Thanks.
e

echoing-dinner-19531

06/07/2022, 3:42 PM
You can still call something like
pulumi.secret
(https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/#secret) soon as you've read it from the environment so that pulumi then treats it as a secret
👍 1
c

clever-address-74879

06/07/2022, 3:45 PM
Thanks @echoing-dinner-19531 I will give it a shot! 💪
v

victorious-ghost-35676

06/15/2022, 6:50 PM
I’ve used makefiles with shell scripts in the past to be able to pass these into your pulumi configuration.