Terraform monorepo support

Monorepo Support

🧩 Monorepo Support

Terracotta now supports monorepos with multiple infrastructure projects in a single repository. Whether you're managing a mix of Terraform and CDK (TypeScript) projects or multiple independent infrastructure stacks, Terracotta has you covered.

🚀 How It Works

If Terracotta is already installed in your repository, no extra configuration is needed. Simply open a pull request, and Terracotta will:

  1. Automatically detect which infrastructure projects are affected by the changes.
  2. Begin reviewing the changes in parallel across all detected projects.
  3. Drop a comment right away to let you know it’s working on the analysis.

You'll see something like:

Terracotta is analyzing your changes… hang tight!

🧠 Project Detection

Terracotta intelligently identifies the root of each project based on the changed files:

  • Terraform Projects:

    Looks for a main.tf or backend.tf file in the directory tree to identify the project root.

  • CDK Projects (TypeScript only):

    Currently supports .ts files and uses the presence of a cdktf.json file to locate the CDK project root.

If your PR touches both Terraform and CDK projects in the same repo, Terracotta will run separate reviews for each and post results accordingly.

✅ Example Use Case

Imagine a monorepo like this:

css
CopyEdit
infrastructure/
├── terraform-ecs/
│   ├── main.tf
├── cdk-s3/
│   ├── lib/
│   │   └── bucket.ts
│   └── cdktf.json

If a PR changes both main.tf and bucket.ts, Terracotta will detect the Terraform and CDK projects independently and review each in context within the PR.