Can please help me break down stacks vs projects? ...
# general
a
Can please help me break down stacks vs projects? My current understanding is that a Project should be high level like Prod and Dev environments then a stack would be smaller cases of the managed environments. Here's the structure I am going for, is this best practice? Project: AWS_Prod Stack: ◦ s3 ◦ ec2 Project: AWS_Dev Stack: ◦ s3 ◦ ec2 Project: Okta_Prod Stack: ◦ users ◦ authentication
l
Most people prefer to use a project as a group of related resources that need to be deployed at the same time (e.g. shared database, app1, shared network, etc.); and a stack is an instance of the (e.g. dev, staging, prod).
1
So you can deploy a prod database and a dev database from the same project.
The code is shared between all stacks in a project, and the stack is just the configuration values, like region, prefix, etc.
a
This is awesome man thanks for the help!
Typically I like to keep dev and prod isolated completely. It seems like it would be bad practice to have dev code right next to prod code. But I guess in pulumi context you still have to specify the stack so theoretically it's isolated?
l
The purpose of non-prod code is to ensure prod code is good.
If you're not using prod code in earlier stacks, then you may want to rethink.
You said " It seems like it would be bad practice to have dev code right next to prod code." There is no "next to". It's the same code. Dev is just different parameters.
c
I agree that having all environments/stacks use the same code is a huge advantage - being able to just change a stack name (and perhaps a region) and deploy in Pulumi is really powerful. The only wrinkle I’ve found is for globally shared resources (mainly AWS Route53 zones) for which I have a
global
project and a single
all
stack that I can reference.