https://pulumi.com logo
Title
n

nice-architect-47483

12/28/2022, 12:25 PM
Hello team, we are moving from monolithic stacks to micro-stacks, is there any best practices for sharing config between stacks? let's say we have a monolithic infra's stack with a few environments, and we want to migrate to micro-stacks which having separated microservices + lambda + infra's stacks, and they need to re-use a lot of shared-config, for example, the directory. Thanks in advance
.
├── application
│   ├── Pulumi.dev.yaml
│   ├── Pulumi.next.yaml
│   ├── Pulumi.prod.yaml
│   ├── Pulumi.staging.yaml
│   ├── config.ts
│   ├── index.ts
├── infrastructure
│   ├── Pulumi.dev.yaml
│   ├── Pulumi.next.yaml
│   ├── Pulumi.prod.yaml
│   ├── Pulumi.staging.yaml
│   ├── config.ts
│   └── index.ts
└── lambda
    ├── Pulumi.dev.yaml
    ├── Pulumi.next.yaml
    ├── Pulumi.prod.yaml
    ├── Pulumi.staging.yaml
    ├── config.ts
    └── index.ts
m

millions-furniture-75402

12/28/2022, 1:48 PM
A pattern we like to use is "base/shared infrastructure" and "Stack References". Your base stack with shared resources is responsible for those resources and exports outputs for other "child" stacks to reference. This works with configuration as well. https://www.pulumi.com/docs/guides/organizing-projects-stacks/#using-stack-references-with-micro-stacks
m

many-telephone-49025

12/28/2022, 2:33 PM
Hi Harry, What @millions-furniture-75402 wrote! I don't want to open the Monorepo vs Multi Repo discussion but could be something to discuss inside your organisation. What also helps is the usage of Project level configuration to share for the different stacks.
n

nice-architect-47483

12/29/2022, 3:18 AM
thanks, @millions-furniture-75402 and @many-telephone-49025 I'll explore them 🙂