Setting up 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.
Setting up monorepo support
- Click into the
repoin which you want to set up mono repo support
- In the
Overviewtab, you'll see theDirectoriessection. By default, this is set toroot directory. - To set up the
monorepodirectories, simply edit or delete therootdirectory first. - Select
New Directoryand add aNameand thesub-directory -
That's it. Terracotta AI will now automatically detect which directory has a new incoming PR and run specifically on the subdirectory listed (see above screenshot as an example.
🚀 How It Works
If Terracotta is already installed in your repository, no extra configuration is needed. Open a pull request, and Terracotta will:
- Automatically detect which infrastructure projects are affected by the changes.
- Begin reviewing the changes in parallel across all detected projects.
- 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.tforbackend.tffile in the directory tree to identify the project root. -
CDK Projects (TypeScript only):
Currently supports
.tsfiles and uses the presence of acdktf.jsonfile 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.
Updated 4 days ago
