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

orange-ghost-99337

01/09/2020, 7:33 AM
is there a way to set common config to use for all stacks?
b

broad-helmet-79436

01/09/2020, 9:35 AM
I don’t think so, but you can create a separate Pulumi project with a stack that exports common config, and use a StackReference to read that config in your project 🙂
or, I mean, you could just hard code the values in your code, since you want to use the same value for every stack
o

orange-ghost-99337

01/09/2020, 9:52 AM
@broad-helmet-79436 Thanks for your response. Lets say if you have multiple applications(say a, b. c..), and different envs (say qa, staging, prod). so each application has the same conf file across all regions, but different values (e,g.. database_user is different for each env) what is the best way to structure ? My understanding -
Copy code
pulumi
  - project-a
      - Pulumi-qa.yaml
      - Pulumi-staging.yaml
      - Pulumi-prod.yaml
  - project-b
      - Pulumi-qa.yaml
      - Pulumi-staging.yaml
      - Pulumi-prod.yaml
but problem is i don't want to have three different configs for an application. instead, i would like to have common config and have nested or structured config yaml file e.g
Copy code
config:
  project-a:db-user
    qa: 'qa-user'
    staging: 'stg-user'
    prod: 'prod-user'
i feel that would ease developers to manage existing configs or add new ones..
b

broad-helmet-79436

01/09/2020, 10:00 AM
Ah… I’m not sure then. I don’t think you can combine everything into a single config file 😕
o

orange-ghost-99337

01/09/2020, 10:00 AM
oh
b

broad-helmet-79436

01/09/2020, 10:00 AM
I suppose you could do what you want with python/typescript/whatever code instead, though
o

orange-ghost-99337

01/09/2020, 10:01 AM
yeah... but i am not sure how to handle with secrets in that case
b

broad-helmet-79436

01/09/2020, 10:01 AM
add environment name and project name as config variables for everything, and use that to look up the correct object
nope, secrets are hard 😕
o

orange-ghost-99337

01/09/2020, 10:02 AM
i can have custom created config and have structured yaml to support three diff environments values, but seems secrets are supported only if you use cli or standard config file that pulumi generate
b

broad-helmet-79436

01/09/2020, 10:03 AM
yeah. sorry I can’t be of more help 🙂
o

orange-ghost-99337

01/09/2020, 10:04 AM
np, will try to see if i can find more info. Thank you
@white-balloon-205 would appreciate your recommendation on above scenario. Thanks
p

plain-eye-9759

01/09/2020, 12:17 PM
I needed something like this. How I went about it was using a task runner(Gulp) to flatten my configurations before running
pulumi up
. I have a file that has common configs then then the gulp task will combine the common settings and the stack-specific settings into all the
pulumi.stack.yaml
files.