Stacks is primarily designed to be used in Terraform monorepos.
We define a Terraform monorepo as a single version control repository whose code maps to two or more Terraform states. You can have multiple Terraform monorepos as long as they all map to more than one state each.
While perfectly possible to use in "1 repository = 1 state" setups, Stacks shines brightest when "1 repository = N states".
If your setup is not monorepo-like, we do not recommend you use Stacks.
Stacks was originally developed to run on top of Atlantis. Atlantis does support code pre-processors in the form of pre-workflow hooks.
Unfortunately, not all Terraform automation tools are flexible enough for you to run a thing that will modify your checked-out code before Terraform consumes it.
Same restrictions apply to any code scanning tools you may be using. You'll have to put Stacks before them, which may not be possible depending on what continuous integration platform they're running on.
If your Terraform automation pipeline does not support such code pre-processors, you cannot use Stacks.
Since not all Stacks' input code is valid HCL, formatters like terraform fmt
will not work.
You can still use code formatters in output code, but since its not meant to be persisted anywhere there's little to no reason to do that either.
If format enforcing through code formatters is something you're not willing to give up, you cannot use Stacks.