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

modern-art-40204

07/27/2023, 6:58 AM
is there anyway to split Pulumi.<stack>.yaml to multiple files or import another file? my config is too big, so it very hard for user to edit a big file My only idea is store config in python file (but format is more verbose than YAML)
or maybe store in self managed yaml file
s

swift-australia-61553

07/27/2023, 7:06 AM
@modern-art-40204 perhaps you could extract all the common configs in a project level config and use stack configs for whats left? https://www.pulumi.com/blog/project-config-mvp/
m

modern-art-40204

07/27/2023, 7:10 AM
there is no common config I have a stack of keycloak It have many clients, roles A lot of users + role mapping
c

cuddly-computer-18851

07/27/2023, 8:15 AM
keycloak has its own config export/import mechanism, maybe leverage that ( or write a Keycloak Provider 😃 )
m

modern-art-40204

07/27/2023, 8:21 AM
User don't need to edit python code for every new user role mapping I use a for loop over CONFIG to do that So the question only is
is there a good way to split config?
I has decised to store config in many yaml, then use pyyaml to load it
s

swift-australia-61553

07/27/2023, 8:32 AM
@modern-art-40204 in your case I believe this is a good approach. I assume each stack is a standalone version of the setup for each user, correct?
m

modern-art-40204

07/27/2023, 10:10 AM
hmm, I only have one keycloak stack other stack is used for different purpose
f

fresh-scientist-56300

07/27/2023, 4:55 PM
So I the method I was using utilized
spruce
./spruce.sh
Copy code
spruce merge accounts/*.yaml sso_permission_sets/*.yaml templates/*.yaml sso/*.yaml
e.g. accounts/backups.yaml:
Copy code
resources:
  AWS backups:
    type: aws:organizations:Account
    properties:
      email: aws+backups@XXXXXX
      name: AWS backups
      parentId: XXXXXX
      tags:
        Name: AWS backups
        environment: prod
    options:
      protect: true
outputs:
  aws_accounts:
    AWS backups:
      account_id: ${AWS backups.id}
Pulumi.yaml:
Copy code
name: infra
runtime:
  name: yaml
  options:
    compiler: "./spruce.sh"
description: A minimal Pulumi YAML program
239 Views