I look everywhere, but can’t find an answer to this:
Say you have 3 envs, fonc, accp and production. You build a webapp, or vm in azure and all is fine for fonc and accp, but then comes production, which requires scaling since it’s prooduction, so the code that worked fine for fonc and accp cannot be used “as is” in production since the archiecture of the solution differ at that stage. I found no way to do a “if” in terraform(if production = 1 then run webapp_prod which include redundancy and scaling)
Anyone can point me toward an article, tutorial, best practice where a solution to this is described?
Thanks!
Hi @kinwolfqc,
What you’ve asked here is difficult to answer in the abstract because the tradeoffs can be different depending on how your system is put together. Some high-level resources I would suggest reviewing are:
-
Module Composition: a guide on writing small, shared Terraform modules that can be combined together in different ways in different configurations to represent differing requirements, such as production having more complexity for increased redundancy.
- There’s a little additional content along those lines in the section When to use Multiple Workspaces, in the examples of what to do instead of using multiple workspaces to represent environments. Specifically, it talks about using a separate configuration for each environment but then sharing modules between them to represent the parts that are common.
I’m sorry that’s just some vague gesturing and not a specific answer, but hopefully the content there will give you some different ideas to consider and I’m happy to try to answer more specific questions that might arise from considering them.
1 Like