Per-Module Version Management for Terraform Monorepos
Automated version control and documentation for Terraform modules in GitHub monorepos
1Module Management in Monorepos
Terraform Module Releaser is a GitHub Action that enables independent version control for Terraform modules in GitHub monorepos. It automatically creates Git tags and GitHub releases for each module. Although modules reside in a single repository, it performs module-specific versioning based on commit messages, enabling independent management. This approach allows for cleaner dependency management between modules in large-scale Terraform infrastructures.
2Smart Versioning System
The action analyzes commit messages to automatically determine major, minor, or patch version bumps. Supporting Conventional Commits format, this system works according to semantic versioning principles. For example, 'feat:' prefix triggers minor version, while 'fix:' triggers patch version increments. Module version history is automatically tracked, and separate changelogs are generated for each module.
3Comprehensive Documentation Generation
Automatically produces rich documentation pages for each module. Generates wiki pages containing terraform-docs outputs, usage examples, and complete version history. The created documentation integrates with GitHub Wiki. This ensures teams always have access to up-to-date and consistent documentation when using the modules.
4CI/CD Integration
Easily integrates with GitHub Actions workflows. Works on pull requests by adding automatic comments. Automates release creation, tagging, and wiki updates. Works in both GitHub.com and GitHub Enterprise Server (GHES) environments. Offers seamless operation in both cloud and on-premises setups.
5Performance Optimization
Isolates module directory contents to tag only relevant files. This approach significantly improves Terraform performance. Reduces Terraform plan/apply times in large monorepos. Prevents unnecessary dependencies between modules. Automatically cleans up tags for deleted modules to keep the repository organized.
6Zero Configuration
Works with default settings for immediate productivity. Requires minimal configuration thanks to sensible defaults. Offers extensible parameters for custom needs. Can be flexibly customized to match team workflows. Operates within GitHub ecosystem without external dependencies.
7Module Structure Recommendations
Recommends avoiding nested Terraform modules by keeping each in separate directories. Suggests grouping modules by provider namespaces (like aws, azure). Each module should have a name that clearly reflects its purpose. Hierarchical structures like 'aws/vpc' or 'azure/storage' can be used. This approach clarifies relationships between modules.
8Setup and Getting Started
Getting started requires adding a simple YML file to .github/workflows directory. Wiki feature must be enabled for the repository. Ensure GitHub Actions runner has necessary permissions. Requires pull-requests: write permission to work on PRs. Check permissions if encountering 403 errors.
9GitHub Enterprise Support
Compatible with GitHub Enterprise Server 3.16 or later. Requires Actions runners v2.327.1+. GHES 3.19+ automatically enforces compatible minimum runner version. Requires wiki feature enabled on internal GitHub instances. Administrators should ensure wikis aren't disabled.
10Demo and Examples
TechPivot's Terraform Modules Demo repository provides real-world usage examples. Shows practical implementations in monorepo structures. Offers best practices for module organization. Ideal for observing action behavior in different scenarios. Serves as an excellent starting point for beginners.
11Customization Options
Default behaviors can be customized through extensive parameter sets. Commit message format, versioning rules, and documentation outputs are configurable. Workflow can be modified according to team needs. All configuration options are thoroughly documented in Input Parameters section. Advanced customizations possible as the action is open source.
12Impact on DevOps Processes
Improves DevOps processes by standardizing Terraform module management. Reduces human error risk through automated version tracking. Eliminates information asymmetry with documentation automation. Brings monorepo advantages to Terraform world. Enhances manageability in large-scale infrastructure projects.
Original article: Hacker News: Show HN — Terraform Monorepo'larında Modül Bazlı Sürüm Yönetimi