What are some of the best practices you use when d...
# general
What are some of the best practices you use when defining stacks that are substantially different based on environments (e.g. dev/stage/prod)?
For example, I have an
that creates a Cognito User Pool and related resources (App Clients, domains, etc).
In this example, my
stage looks very different from my
stage in terms of resources created
, I may have dozens of App Clients and Domains associated with my User Pool. In
, I may just create a single User Pool with a single App Client.
The amount of IaC needed to create these resources is rather verbose, and goes beyond swapping out a configuration value based on stage
I could use a single stack to organize all of this, but I envision it growing rather unwieldy with lots of conditional logic around the stage. This feels like a code smell
I've started to have extremely granular stacks
esp with the new functional stack stuff it's really easy to have a lot of small stacks. Then each stack has conditional code for the different envs, it's annoying but more manageable when the stacks are smaller
but of course the ideal is you avoid needing conditions all together but not always possible
Yeah, I'm finding the stage conditions to be tricky to avoid here.
maybe I'll start with a big 'ol stack and feel the pain first, then refactor. After all, the resources created in AWS will be the same. This is more a question of good code hygiene within my constructs
new functional stack stuff
@thdxr, can you expand here?
we haven't officially released it yet, working on a bunch of docs but I left an example here: https://serverless-stack.slack.com/archives/C01JVDJQU2C/p1646951175298129?thread_ts=1646950522.278839&cid=C01JVDJQU2C
It's a tough one. I guess passing in config to the stack declared in
is possibly an option? Perhaps pull in values from som sort of config module or something using