Skip to content
Calcrivo

Terraform Workspace Calculator

Calculate total resources across Terraform workspaces and the isolation benefit of splitting environments.

Inputs

workspaces

Number of Terraform workspaces (e.g. dev, staging, prod, qa).

resources

Average resources managed within a single workspace.

%

Percent of resources that are effectively duplicated/shared logic across workspaces (isolation cost).

Total Resources Across Workspaces

340resources

Blast Radius Isolation Benefit

75.0%

Duplicated/Shared-Logic Resources

34resources

Step by step

  1. Total resources: workspaces × resources per workspace

    4 × 85

    = 340 resources

  2. Duplicated resources from overlap

    340 × 10%

    = 34 resources

  3. Isolation benefit: 1 − 1/workspaces

    1 - 1/4

    = 75.0%

How it works

Formula: total_resources = workspaces × resources_per_workspace. Splitting environments into separate workspaces isolates state and blast radius — a bad apply in 'dev' can't directly corrupt 'prod' state. Isolation benefit is modeled as 1 − 1/workspaces: with 4 workspaces, a single mistaken apply affects roughly 1/4 of your total resource footprint rather than all of it.

Formulas

Total resources

total_resources = workspaces × resources_per_workspace

workspaces
Number of Terraform workspaces
resources_per_workspace
Average resources per workspace

Isolation benefit

isolation_benefit_percent = (1 - 1 / workspaces) × 100

workspaces
Number of isolated workspaces

Frequently Asked Questions

Should I use Terraform workspaces or separate state files/backends per environment?

Native workspaces are lightweight but share the same backend config and variables unless you branch logic on `terraform.workspace` — many teams prefer fully separate root modules/backends per environment for stronger isolation and independent access control.

What's the main risk workspaces don't solve?

Workspaces isolate state but not code — a bug in your shared `.tf` configuration still affects every workspace that uses it, so isolation benefit applies to blast radius from bad applies, not from bad code.

How many workspaces is too many?

There's no hard limit, but beyond a handful (e.g. per-environment) many teams switch to per-customer or per-region workspaces only with tooling to manage them at scale, since manual `terraform workspace select` becomes error-prone.

Does workspace count affect state storage cost?

Yes — each workspace has its own state file, so total backend storage scales with workspace count × state size × versions retained (see the backend storage calculator).

You might also need