is there anyway to split Pulumi.<stack>.yaml...
# general
m
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
@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
there is no common config I have a stack of keycloak It have many clients, roles A lot of users + role mapping
c
keycloak has its own config export/import mechanism, maybe leverage that ( or write a Keycloak Provider 😃 )
m
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
@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
hmm, I only have one keycloak stack other stack is used for different purpose
f
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
413 Views