Tfaction: GitHub Actions for Monorepo Terraform Workflows
Managing Terraform at scale in a monorepo can get messy. You end up with a tangle of custom GitHub Actions workflows, duplicated logic, and complex dependencies between directories. It's a problem many infrastructure teams face but few solutions tackle head-on.
Enter Tfaction, a framework built specifically for GitHub Actions to create consistent, high-level Terraform workflows across a monorepo. It abstracts the boilerplate so you can focus on your infrastructure code, not your CI/CD pipeline code.
What It Does
Tfaction provides a reusable, opinionated workflow framework for Terraform monorepos. Instead of writing a unique GitHub Actions workflow for every Terraform module or environment, you configure a single set of workflows that understand your repository's structure. It handles common operations like plan, apply, and drift detection across multiple directories, while managing dependencies between them.
At its core, it's a collection of reusable GitHub Actions workflows and composite actions that you bring into your repository. You define your targets and dependencies in a configuration file, and Tfaction orchestrates the rest.
Why It's Cool
The clever part is how it reduces complexity. In a typical monorepo, you might have a production directory that depends on a network module, which itself depends on a base module. Running a plan for production should account for changes in its dependencies. Tfaction automatically discovers and handles these dependency graphs.
It also enforces consistency. Every Terraform directory in your repo gets the same treatment: the same plan output format, the same apply safeguards, the same drift detection. This is huge for team collaboration and reducing "works on my machine" issues.
Another neat feature is its focus on GitHub's native features. It uses the GitHub Actions job summary for clean plan outputs, creates pull request comments automatically, and integrates with GitHub's environment protection rules. It feels like a natural extension of the platform, not a third-party bolt-on.
How to Try It
The quickest way to see Tfaction in action is to check out the example repository. It shows a complete monorepo setup with dependent modules.
- Head over to the Tfaction GitHub repository.
- Look at the
exampledirectory to see a sample structure. - The
usagedocumentation walks you through adding the framework to your own repo, which involves copying the workflow files and creating atfaction-root.yamlconfig at your root.
You don't install a tool; you adopt a workflow pattern. This makes it lightweight to start with—you can apply it to a single directory first and expand from there.
Final Thoughts
If your team is wrestling with scaling Terraform in a single repository, Tfaction is worth a look. It solves a specific, painful problem without introducing yet another external SaaS tool or a complex CLI. It feels pragmatic. You get standardization and dependency management by leaning into the GitHub Actions ecosystem you're already using.
It won't be for everyone—if you have a simple single-module repo or are all-in on a different CI system, it's overkill. But for teams growing into a monorepo pattern, it provides a much-needed scaffold to keep things sane. It’s the kind of focused tool that quietly makes a lot of repetitive work disappear.
@githubprojects