Interview Prep/Terraform/Pipelines Terraform Cloud and OpenTofu

In a monorepo with 40 stacks, how do you plan only the stacks that changed?

AdvancedScenarioPipelines Terraform Cloud and OpenTofu
Answer

Situation read → Planning everything on every PR is slow and noisy.

What I'd do →

  1. Detect changed paths (git diff --name-only origin/main...HEAD) or use paths: filters.
  2. Map changed module directories to the stacks that use them.
  3. Generate a job matrix of affected stacks and run plans in parallel.
  4. Apply in dependency order (network before apps).

Why → Affected-only plans scale; a shared module change correctly fans out to all consumers.

Interview tip → Shared module changes are the case naive path filters miss.

All Terraform questions Roadmap: Terraform in production

More on Pipelines Terraform Cloud and OpenTofu