Forgecroft Docs
Guides / Stacks

Stacks

Manage multiple environments from a single configuration with automatic promotion between them.

The Problem

You have the same Terraform code across dev, staging, and production. Each environment needs different .tfvars values, but you want consistent configuration and a promotion path from dev → staging → prod.

Without stacks, you’d create three workspaces manually:

The Stack Solution

A stack is a multi-environment workspace template. One API call creates:

Before vs After

Manual approach:

Create workspace "myapp-dev"     → configure repo, branch, credentials, state
Create workspace "myapp-staging" → configure repo, branch, credentials, state
Create workspace "myapp-prod"    → configure repo, branch, credentials, state
Manually add dependency edges for promotion

Stack approach:

POST /stacks {
  "name": "myapp",
  "environments": [
    { "name": "dev",     "var_files": ["env/dev.tfvars"],     "promote_to": ["staging"] },
    { "name": "staging", "var_files": ["env/staging.tfvars"], "promote_to": ["prod"] },
    { "name": "prod",    "var_files": ["env/prod.tfvars"] }
  ]
}
→ Creates 3 workspaces + promotion graph in one atomic operation

Naming Conventions

When to Use Stacks

Use stacks when:

Use individual workspaces when:

Next Steps