And get it with ```var config = new Pulumi.Config(...
# dotnet
c
And get it with
Copy code
var config = new Pulumi.Config();
var name = config.Require("ConnectionString");
e
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
Thanks @echoing-dinner-19531. So the
pulumi.<stack-name>.yml
file is used for non-secret environment specific things?
d
No, it's used for secrets - but afaik, doesn't fall back to getting things from the environment.
w
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
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
So how do you get secrets in there in CI/CD? Replace a placeholder in the workflow/pipeline or something else? 🙂
e
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
Right, that was what I was getting at 🙂 Thanks.
e
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
Thanks @echoing-dinner-19531 I will give it a shot! 💪
v
I’ve used makefiles with shell scripts in the past to be able to pass these into your pulumi configuration.