Thank you for your interest in contributing to the Terraform Turing Pi Modules!
- Terraform >= 1.0
- TFLint
- Trivy
- terraform-docs
- pre-commit
# TFLint
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
# Trivy
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin
# terraform-docs
curl -sSLo ./terraform-docs.tar.gz https://terraform-docs.io/dl/v0.19.0/terraform-docs-v0.19.0-$(uname)-amd64.tar.gz
tar -xzf terraform-docs.tar.gz
chmod +x terraform-docs
sudo mv terraform-docs /usr/local/bin/
# pre-commit
pip install pre-commit-
Clone the repository:
git clone https://github.com/freed-dev-llc/terraform-turingpi-modules.git cd terraform-turingpi-modules -
Install pre-commit hooks:
pre-commit install
-
Initialize TFLint plugins:
tflint --init --config .tflint.hcl
Pre-commit hooks run automatically on git commit. To run manually:
pre-commit run --all-files# Format all Terraform files
terraform fmt -recursive
# Validate a specific module
cd modules/talos-cluster
terraform init -backend=false
terraform validate
# Run TFLint on a module
tflint --config "$PWD/.tflint.hcl" --chdir modules/talos-cluster
# Run security scan
trivy config --config trivy.yaml .
# Generate documentation
terraform-docs --config .terraform-docs.yml modules/talos-cluster- Create a feature branch from
main - Make your changes
- Ensure all checks pass:
terraform fmt- Code formattingterraform validate- Syntax validationtflint- Linting rulestrivy- Security scanningterraform-docs- Documentation is up-to-date
- Update documentation if adding/changing variables or outputs
- Submit a pull request
All PRs must pass:
- Terraform validation for all 10 modules
- Security scan (Trivy)
- Code owner review (@jfreed-dev)
Each module should contain:
modules/<name>/
├── main.tf # Main resources
├── variables.tf # Input variables (with descriptions)
├── outputs.tf # Output values (with descriptions)
├── versions.tf # Provider requirements
└── README.md # Documentation with <!-- BEGIN_TF_DOCS --> markers
Module READMEs use terraform-docs for auto-generated sections. Add these markers where you want the generated content:
<!-- BEGIN_TF_DOCS -->
<!-- END_TF_DOCS -->The sections above the markers (Usage examples, etc.) are manually maintained.
- Use
snake_casefor resource names, variables, and outputs - Include descriptions for all variables and outputs
- Use
optional()for optional object attributes with defaults - Keep provider version constraints in
versions.tf - Avoid hardcoded values; use variables with sensible defaults
The test/ directory is gitignored, but test configs must still follow secure patterns:
- Never hardcode passwords in
.tffiles — usevariableblocks withsensitive = true - Supply values via
terraform.tfvars(also gitignored) or environment variables (TF_VAR_*) - No default values on sensitive variables — require explicit input
Example pattern:
variable "grafana_password" {
description = "Grafana admin password"
type = string
sensitive = true
}
module "monitoring" {
source = "../../modules/addons/monitoring"
grafana_admin_password = var.grafana_password
}With a corresponding terraform.tfvars:
grafana_password = "your-password-here"Follow conventional commit style:
feat:New featuresfix:Bug fixesdocs:Documentation changeschore:Maintenance tasksrefactor:Code refactoring
Releases are created by tagging the main branch. All releases are GPG-signed.
-
Update
CHANGELOG.mdwith the new version -
Commit the changelog update:
git add CHANGELOG.md git commit -S -m "docs: update changelog for v1.x.x" -
Create a signed tag:
git tag -s v1.x.x -m "Release v1.x.x" -
Push to origin:
git push origin main --tags
-
Create the GitHub Release from the tag. The pushed tag does not create a Release automatically (only the Terraform Registry auto-indexes tags), so this step is required — skip it and the Registry will show the new version while GitHub Releases still shows the previous one. Use the matching
CHANGELOG.mdsection as the body and--verify-tagso it never creates a new tag:gh release create v1.x.x --verify-tag --title v1.x.x --notes-file CHANGELOG-v1.x.x.md
(Paste the version's
CHANGELOG.mdsection into a temp file for--notes-file, and end it with a**Full Changelog**: …/compare/v1.<prev>...v1.x.xlink.)
After pushing the tag and creating the Release:
- Verify the release appears on GitHub Releases and is marked Latest
- Confirm it syncs to Terraform Registry
- GPG key configured for commit/tag signing (
git config commit.gpgsign true) - GPG key registered on GitHub for verified badges
- Push access to the repository
The main branch has protection rules configured in GitHub. Recommended settings:
Enable "Require status checks to pass before merging" with these checks:
validate(Terraform validation)trivy(Security scanning)dependency-review(For PRs)
- Require pull request reviews: At least 1 approving review
- Dismiss stale reviews: When new commits are pushed
- Require review from Code Owners: Enabled (see CODEOWNERS)
- Require signed commits: Recommended for verified releases
- Require linear history: Optional, keeps history clean
- Do not allow bypassing: Even admins should follow the rules
Open an issue for questions or suggestions.