Versioning & Release Strategy
September 29, 2025 ยท View on GitHub
This document describes the versioning and release strategy for the terraform-aws-modules repository.
๐ Table of Contents
- Overview
- Versioning Strategy
- Automated Release Process
- Manual Release Process
- CI/CD Validation
- Best Practices
- Troubleshooting
Overview
This repository uses a global versioning strategy where all modules are versioned together as a single repository. This approach provides:
- Consistency: All modules are tested and released together
- Simplicity: One version number for the entire repository
- Compatibility: Ensures module inter-dependencies work correctly
- Traceability: Clear history of what changed in each release
Versioning Strategy
We use Semantic Versioning (SemVer) with the format vMAJOR.MINOR.PATCH:
Version Components
-
MAJOR (
v2.0.0): Incompatible API changes or breaking changes- Removing or renaming module input variables
- Changing variable types or validation rules
- Removing modules entirely
- Changes that require users to update their configurations
-
MINOR (
v1.1.0): New functionality in a backwards-compatible manner- Adding new modules
- Adding new optional input variables
- Adding new output values
- New features that don't break existing usage
-
PATCH (
v1.0.1): Backwards-compatible bug fixes- Fixing bugs in existing functionality
- Documentation updates
- Security patches
- Internal refactoring without API changes
Why Semantic Versioning?
- Industry Standard: Widely adopted and understood
- Terraform Ecosystem: Compatible with Terraform registry and tooling
- Dependency Management: Allows safe pinning to minor versions
- Clear Communication: Breaking changes are immediately apparent
Automated Release Process
Triggers
Releases are automatically triggered when:
- Changelog Updates: Changes are merged to
mainwith updates toCHANGELOG.md - Module Changes: Direct changes to files in the
modules/directory - Manual Trigger: Using GitHub Actions workflow dispatch
- Release File: Updates to the
.release-triggerfile
Workflow Steps
- Change Detection: Identifies what changed and determines release type
- Version Calculation: Bumps version based on release type
- Changelog Update: Moves unreleased changes to the new version section
- Git Tagging: Creates and pushes a new git tag
- GitHub Release: Creates a GitHub release with release notes
- Notification: Updates relevant documentation and links
Release Type Detection
The automation determines release type from:
- Commit Messages: Include
release-type: major|minor|patch - PR Description: Same syntax in PR description
- Default: If not specified, defaults to
minor
Manual Release Process
Using the Release Script
# Validate changed modules
./scripts/release-manager.sh validate-modules
# Create a new release
./scripts/release-manager.sh create-release --type=minor
# Update changelog only
./scripts/release-manager.sh update-changelog v1.2.3
# List all modules
./scripts/release-manager.sh list-modules
# Dry run to see what would happen
./scripts/release-manager.sh create-release --dry-run --type=patch
Manual GitHub Actions Trigger
- Go to the Actions tab in GitHub
- Select the ๐ Automated Release workflow
- Click Run workflow
- Select the release type and options
- Click Run workflow
Direct Release Process
If automation fails, create releases manually:
# 1. Update CHANGELOG.md
vim CHANGELOG.md
# 2. Commit changes
git add CHANGELOG.md
git commit -m "chore: bump version to v1.2.3"
# 3. Create tag
git tag v1.2.3
# 4. Push changes
git push origin main
git push origin v1.2.3
# 5. Create GitHub release manually
gh release create v1.2.3 --title "v1.2.3" --notes-file RELEASE_NOTES.md
CI/CD Validation
Pre-Release Validation
Every PR triggers validation for changed modules:
- Format Check:
terraform fmt -check - Initialization:
terraform init -backend=false - Validation:
terraform validate - Linting:
tflintwith security and best practice rules - Security Scan:
checkovfor security vulnerabilities - Documentation: Ensures terraform-docs are up to date
Module Change Detection
The CI system automatically:
- Detects which modules changed in a PR
- Runs validation only on changed modules
- Provides PR comments with validation results
- Prevents merge if validation fails
Workflow Validation
Separate workflows validate:
- GitHub Actions workflow syntax
- Release script functionality
- Required workflow presence
- Configuration consistency
Best Practices
For Contributors
- Always update CHANGELOG.md with your changes under
[Unreleased] - Specify release type in PR description when needed
- Test modules locally before submitting PRs
- Follow semantic versioning principles when determining impact
- Document breaking changes clearly in the changelog
For Consumers
-
Pin to specific versions in production:
source = "git::https://github.com/nanlabs/terraform-aws-modules.git//modules/aws-vpc?ref=v1.2.3" -
Use minor version pinning for automatic patch updates:
source = "git::https://github.com/nanlabs/terraform-aws-modules.git//modules/aws-vpc?ref=v1.2" -
Never use
mainbranch in production -
Review changelogs before upgrading versions
-
Test upgrades in non-production environments first
For Maintainers
- Review PRs carefully for breaking changes
- Ensure changelog entries are accurate and complete
- Validate release notes before publishing
- Monitor release automation for failures
- Communicate breaking changes proactively
Troubleshooting
Common Issues
Release Workflow Fails
- Check workflow logs in GitHub Actions
- Verify CHANGELOG.md format follows Keep a Changelog
- Ensure unreleased section has actual changes
- Check git permissions and token scope
Version Calculation Wrong
- Verify commit message format includes
release-type: - Check latest tag exists and follows semver
- Manually trigger with specific version type
Module Validation Fails
-
Run validation locally:
./scripts/release-manager.sh validate-modules -
Check terraform version compatibility
-
Verify module dependencies are satisfied
-
Review linting rules and fix violations
Changelog Not Updated
- Check unreleased section has entries
- Verify file permissions allow writing
- Ensure proper markdown format
- Manually update and commit if needed
Getting Help
- Check workflow logs for specific error messages
- Review this documentation for procedures
- Test with dry-run mode before making changes
- Ask in GitHub Discussions for complex issues
Emergency Procedures
Rollback a Release
# Delete the tag locally and remotely
git tag -d v1.2.3
git push origin :refs/tags/v1.2.3
# Delete the GitHub release
gh release delete v1.2.3
# Revert changelog changes
git revert <commit-hash>
Hot Fix Release
# Create patch release for urgent fixes
./scripts/release-manager.sh create-release --type=patch --force
# Or manually trigger with GitHub Actions
# Select "patch" as release type