If I want to keep multiple stacks for one project ...
# general
e
If I want to keep multiple stacks for one project in a monorepo, can I do sub-dirs for each stack, or is that an anti-pattern?
l
Subdirs for each project is fine. I don't know how it would work, for each stack...
In general, stacks are identical apart from config... the only different is the Pulumi.<stack>.yaml file...
e
Maybe I'm misunderstanding the purpose of stacks
I've created a bunch of Azure infra, and so far I've been managing everything within that project/stack. I'm using multiple k8s clusters now and Pulumi's handling of CRDs is completely screwing things up trying to install identical things (like our API gateway helm chart) into multiple clusters, so I was going to start breaking the clusters out into their own stacks within this project
should that really be separate projects?
m
stacks are instances of a project. As an example, my organization has stacks in the pattern
my-org/my-project/dev.us-east-1
As tenwit said, the only thing different for these instances is the configuration. It is possible to add conditional infrastructure into your plan based on the
pulumi.getStack()
value, but this could be an anti-pattern.
So re-reading your last message, yes, it sounds like you want multiple projects. You can centralize some of the resources in a
shared-infrastructure
or
shared-project
project and export your outputs for the other projects to use via StackReferences.
e
ok cool, thank you for the advice!
c
You probably want organize them into micro-stacks