https://pulumi.com logo
f

fast-florist-41572

08/06/2021, 11:48 AM
I'm trying to understand if its better to use a single project with multiple stacks or multiple projects with one or more stacks. Are there any good examples of complexish setups with pulumi?
b

brave-planet-10645

08/06/2021, 1:04 PM
The advise I tend to give is: logically divide up your resources (networking, databases, application etc) into projects. Stacks should be equivalent to environments, so dev/staging/prod. When it comes to regions, You can use a provider for each region and and then set the provider for the resource
So you'd just have a folder per project and then in each have multiple stack config files where you can specify the differences between each stack. You could also include the regions you want to deploy to in the stack config and have the code build providers based on that
f

fast-florist-41572

08/06/2021, 1:18 PM
Thanks @brave-planet-10645 is there any good example showing that setup?
b

brave-planet-10645

08/06/2021, 1:19 PM
We have this one: https://github.com/pulumi/examples/tree/master/aws-stackreference-architecture It doesn't have multi-region, and it doesn't have multi stack, but the multi projects is what you're looking for really
f

fast-florist-41572

08/06/2021, 1:23 PM
Thanks that looks good. Are stacks conceptually just an overlay config to apply onto a project?
l

lemon-dog-29241

08/06/2021, 1:27 PM
Without trying to hijack this conversation, I have a related question also... 🙂 How do workspaces fit into this idea? I have a stack that is going to be deployed per feature development for a repo, and I'm trying to figure out how to organize that. So I have two projects (one with shared resources and one with resources that will be deployed every time the request is made), then my stacks will determine environment. How would I organize the project that gets deployed per request? Just with naming conventions? Or should I use workspaces somehow?
b

brave-planet-10645

08/06/2021, 2:08 PM
You mean TF workspaces?
Pulumi doesn't have a concept of workspaces
1
@fast-florist-41572 correct
Officially (from the docs):
A stack is an isolated, independently configurable instance of a Pulumi program.
f

fast-florist-41572

08/06/2021, 2:11 PM
Ok thanks, so conceptually I could just use lots of projects to achieve what I want and have a default stack in most cases
b

brave-planet-10645

08/06/2021, 2:11 PM
Yes
f

fast-florist-41572

08/06/2021, 2:11 PM
Awesome, thanks.
Also is there a way to trigger a project that would initiate two other projects/stacks?
ie, if I had networking and db and then I wanted to have a project that was a region. I call that which would initiate the networking first and then the database
b

brave-planet-10645

08/06/2021, 2:20 PM
Not by default. You should look at our automation api, which allows you to integrate your pulumi programs in an application. In this case you could have an application that would orchestrate your deployments like you've said.
g

great-sunset-355

08/06/2021, 5:20 PM
Check #getting-started channel we've had a discussion about it not so long ago, scroll little bit up in history https://pulumi-community.slack.com/archives/C01PF3E1B8V/p1627281036093300
🙌 1
👀 1
f

fast-florist-41572

08/06/2021, 5:26 PM
Thanks @great-sunset-355 will dig into it
2 Views