1.4.3.1. Maintaining Consistent Content Across Multiple Repositories
When adopting a "one module per repository" strategy, we face a practical challenge: how to maintain consistency for shared content across multiple module repositories (the answer can be found here).
Here are some recommended items to keep consistent:
- License File (LICENSE): Clarify the open-source protocol for each module to ensure legal consistency upon public release.
README.md: Maintain consistency in module descriptions and formatting standards (e.g., maintaining unified document headers and footers where necessary). This can be generated automatically usingterraform-docs..gitignoreFile: Prevent Terraform local state files, caches, and temporary files from being included in version control.- Unified Branch Protection Strategy: Enable protection rules for
mainorreleasebranches, such as prohibiting direct pushes and requiring merges via Pull Requests. - Unified Code Merge Standards: Explicitly require at least one Code Review for every Pull Request and ensure validation through the CI pipeline before merging.
- Pull Request and Issue Templates: Configure unified templates in the
.githubdirectory to guide contributors in providing complete context, the purpose of changes, and the expected scope of impact, thereby improving communication efficiency and review quality. - CI/CD Configuration Files: (e.g., GitHub Actions, Azure Pipelines, etc.) Unified pipeline settings for linting, formatting, validation, and testing can enhance quality assurance.
- Module Directory Structure Standards: Standardize the use of files and folders such as
main.tf,variables.tf,outputs.tf,README.md, andexamples/to maintain module consistency and reduce cognitive load. - Global Shared Code: Such as module telemetry data.