Manage Stacks in Nests and Layers

Configure nested and layered stacks in Terraform to run operations quickly and safely, with new rules to give you full control over deployment.

Layered and nested stacks

Layered stacks

Layer stacks to define an order for your operations. Layered stacks form a dependency tree – each one must be applied completely before the next stack can execute.

Layered execution

Layer 1: Network
Layer 2: Database
Layer 3: Application

Nested stacks

Group stacks within a parent stack to ensure they deploy as a group. All the stacks nested within their parent stack have to be applied before the parent stack is completed.

Nested structure

Parent: All Regions
Child: US-East-1
Child: US-West-2
Child: EU-West-1

Example: Layered and nested stacks in action

Dev Environment (Layer 1)
dev/network
dev/database
dev/app
Staging Environment (Layer 2)
staging/network
staging/database
staging/app
Production Environments (Layer 3 - Nested)
US-East-1
prod-us-east-1/network
prod-us-east-1/database
prod-us-east-1/app
US-West-2
prod-us-west-2/network
prod-us-west-2/database
prod-us-west-2/app

Prevent drift with clear dependencies

Problem: Terraform doesn't provide solutions to real-world challenges

Cross-workspace dependencies aren't configured natively, so teams have to add custom scripts and layered runs that confuse orchestration, break promotions, and cause drift between environments.

Without Stacks:

Database ChangeAll Apps TriggerDev + Staging + ProdChaos

Solution: Terrateam Stacks introduces explicit rules and layered and nested structures

Stacks create encapsulated groups with explicit relationships. Changes cascade predictably through your infrastructure, respecting environment boundaries and deployment sequences that map to real-world workflows.

With Stacks:

Database ChangeDev StackStaging StackProd StackControlled Flow

Rules replace configurations

Define explicit rules that control how stacks relate to each other and when they execute.

plan_after

Any stacks that must be applied before this stack can plan. Ensures dependencies are deployed first.

apply_after

Stacks that must be applied before this stack can apply. Create promotion gates across environments.

modified_by

Stacks which, once modified, force this stack to be modified as well. Create cascading changes automatically.

auto_apply

A boolean that determines if a stack should be applied automatically when it passes all apply requirements.

How to configure Terrateam Stacks

Simple YAML configuration creates powerful orchestration logic.

Default stack

If there are no stacks configured, there is an implicit default stack with this definition:

stacks:
  names:
    foo:
      tag_query: ''

Environment promotion example

This creates a dynamic gate that ensures production is only applied when dev is modified as well:

stacks:
  names:
    prod:
      tag_query: production
      rules:
        apply_after:
          - dev
    dev:
      tag_query: development

The benefits of Terrateam Stacks

Speed

Break infra into groups, run them in parallel, only apply what changed

Safety

A smaller blast radius, with explicit dependencies between environments

Control

Create and enforce dependencies across workspaces and teams

Environment Promotion

Define deployment rules so promotion is automatic and safe

How Terrateam Stacks compares

FeatureTerrateamTerramateHashiCorpTerragruntSpacelift
Stack dependencies
Custom stack rules
Nested stacks
Layered stacks
Marko Kuljanski
"We now have more confidence in our deployments, better security with our service accounts, and an overall improved workflow that our entire team appreciates."

Marko Kuljanski, Engineering at Patients Know Best

Have full control across workflows

Solve the "what runs first?" problem with clear dependencies across all your workspaces, environments and teams using Terrateam Stacks.

Get started now

Deploy infrastructure with confidence using layered and nested stacks. Configure dependencies that match your real-world workflows.