https://pulumi.com logo
#general
Title
# general
b

best-hospital-12760

05/19/2020, 11:01 AM
👋 Hi there, new Pulumi user here, great project! It's great to be able to unit test infra code with the same tooling as application code. I have a question regarding structured configuration in
pulumi.yaml
and
pulumi-stackname.yaml
. starting a thread so I don't turn general into pastebin 😄
Background • I have 3 individual stacks ( development, staging, production ) • I'm looking for a way to share these stacks across a team without sharing my individual secrets (I am using Pulumi to quickly spin up test environments for individual engineers) • Any engineer in my team might want to clone this repo, and create their own stack, for example; bobs-stack, defining their individual overrides as required • I would like to define global input parameters, which I share with the team included in source control. This will have with default options set but then allow individuals to override these at an individual stack level • Individual then include these in Pulumi.XXX.yaml which are in .gitignore and not included in source control Where I'm stuck • Some of the examples I've found seems to indicate you can define inputs in Pulumi.yaml under the config section, but I believe after reading some more recent information and issues in GitHub, this might be deprecated? Pulumi.yaml
name: my-example-stack
runtime: go
template:
config:
my-example-stack:my-variable:
description: Input variable in the stack namespace defined for all stacks
default: HELLO-WORLD-IN-ALL-STACKS
• Or, are you supposed to only do it via individual stacks? Pulumi.development.yaml
name: my-example-stack
runtime: go
template:
config:
my-example-stack:my-variable:
description: Input variable in the stack namespace defined for all stacks
default: HELLO-WORLD-IN-ONLY-THE-DEVELOPMENT-STACK
• Or is there another way I can achieve global defaults and allow individuals to override settings before deploying their owns stacks?
f

future-barista-68134

05/19/2020, 1:35 PM
I think the easiest way to set global defaults currently is to use null-coalescing operators for config in the code itself. See typescript example below:
Copy code
import * as pulumi from "@pulumi/pulumi";

const config = new pulumi.Config();

// Use null-coalescing operator to set default values
const exampleValue = config.get("example-key") ?? "default-value";

export const configValue = exampleValue;
👍 1
To answer your question on project level config.. it’s not available and is tracked in this issue: https://github.com/pulumi/pulumi/issues/2307
Here’s the official response to this question in the past. Since Pulumi uses real programming languages you can create your own convention 🙂: https://pulumi-community.slack.com/archives/CJ909TL6P/p1575985418099700?thread_ts=1575973362.095100&cid=CJ909TL6P
b

best-hospital-12760

05/19/2020, 11:01 PM
Thanks very much, that makes perfect sense!
👍 1