tf-module-scaffolder
Generate production-ready Terraform modules in seconds
Overview
tf-module-scaffolder is a CLI tool that generates best-practice Terraform module structures with a single command. It creates complete, production-ready module scaffolds with proper file layout, documentation, CI/CD pipelines, linting configuration, and example code — all following HashiCorp and community conventions.
Why?
Starting a new Terraform module involves creating 10-15+ files with boilerplate and best practices. This tool does it in seconds while ensuring consistency across your module library.
Features
- Multi-Cloud Support — AWS, Azure, and GCP module templates
- 16 Module Templates — Pre-built for VPC, S3, VNet, Storage Account, GCS, and more
- Production-Ready Structure —
main.tf,variables.tf,outputs.tf,versions.tf,provider.tf - Variable Validation — Built-in validation rules for common patterns (CIDR, naming, etc.)
- CI/CD Pipeline — GitHub Actions workflow for
terraform validate+tflint - Pre-commit Hooks —
terraform fmt,validate,tflint,terraform-docs - TFLint Configuration — Provider-specific linting rules out of the box
- Example Code — Ready-to-use example configurations
- Test Scaffolding — Terratest structure for module testing
- Beautiful CLI — Rich terminal output with file tree visualization
- Three Modes — Interactive wizard, CLI flags, or quickstart presets
Installation
# Clone the repository
git clone https://github.com/SanjaySundarMurthy/tf-module-scaffolder.git
cd tf-module-scaffolder
# Install in development mode
pip install -e ".[dev]"
Quick Start
Quickstart Presets
# Scaffold an AWS VPC module
tf-scaffold quickstart aws-vpc
# Scaffold an Azure Storage Account module
tf-scaffold quickstart azure-storage
# Scaffold a GCP VPC module with custom name
tf-scaffold quickstart gcp-vpc -n my-network
Non-Interactive Mode
# AWS S3 bucket module
tf-scaffold new -p aws -t s3-bucket -n my-s3-module
# Azure VNet module with custom options
tf-scaffold new -p azure -t vnet -n my-vnet -d "Production VNet" -a "Platform Team"
# GCP module with minimal scaffold
tf-scaffold new -p gcp -t gcs-bucket -n my-bucket --no-ci --no-precommit
Interactive Mode
tf-scaffold new
This launches an interactive wizard that guides you through:
- Selecting a cloud provider (AWS / Azure / GCP)
- Choosing a module template
- Naming your module
- Generating the complete file structure
Available Templates
AWS
| Template | Description |
|---|---|
vpc |
VPC with public/private subnets, NAT Gateway, and flow logs |
s3-bucket |
S3 bucket with versioning, encryption, and lifecycle rules |
eks-cluster |
EKS cluster with managed node groups |
lambda-function |
Lambda function with IAM role and CloudWatch |
rds-instance |
RDS instance with parameter groups and subnet groups |
Azure
| Template | Description |
|---|---|
resource-group |
Resource group with management lock |
vnet |
Virtual network with subnets and NSGs |
aks-cluster |
AKS cluster with node pools |
storage-account |
Storage account with containers and lifecycle |
app-service |
App Service with plan and deployment slots |
GCP
| Template | Description |
|---|---|
gcp-vpc |
VPC network with subnets, Cloud NAT, and firewall |
gke-cluster |
GKE cluster with node pools |
gcs-bucket |
Cloud Storage bucket with lifecycle and IAM |
cloud-run |
Cloud Run service with IAM |
cloud-sql |
Cloud SQL instance with databases |
Generated Structure
terraform-aws-vpc/
├── main.tf # Core resources
├── variables.tf # Input variable definitions
├── outputs.tf # Output value definitions
├── versions.tf # Terraform & provider version constraints
├── provider.tf # Provider configuration
├── README.md # Module documentation
├── Makefile # Common Terraform commands
├── .gitignore # Terraform-specific ignores
├── .tflint.hcl # TFLint configuration
├── .pre-commit-config.yaml # Pre-commit hooks
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI/CD
├── examples/
│ └── basic/
│ └── main.tf # Example usage
└── tests/
└── main.tf # Test configuration
CLI Reference
Usage: tf-scaffold [OPTIONS] COMMAND [ARGS]...
Commands:
list List available module templates
new Scaffold a new Terraform module
quickstart Quick-scaffold a module from a preset
Options:
--version Show the version and exit
--help Show this message and exit
tf-scaffold new Options
| Option | Description |
|---|---|
-p, --provider |
Cloud provider: aws, azure, gcp |
-t, --template |
Module template name |
-n, --name |
Module name |
-o, --output-dir |
Output directory (default: current) |
-d, --description |
Module description |
-a, --author |
Author name |
--no-examples |
Skip examples directory |
--no-tests |
Skip tests directory |
--no-ci |
Skip CI workflow |
--no-precommit |
Skip pre-commit config |
--no-makefile |
Skip Makefile |
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest -v
# Lint
ruff check .
# Format check
ruff format --check .
Architecture
tf_module_scaffolder/
├── models.py # Data models (Provider, ModuleType, Config)
├── engine.py # Scaffold engine (file generation)
├── cli.py # Click CLI commands
├── templates/
│ ├── hcl.py # Jinja2 HCL templates
│ └── definitions.py # Variable/output definitions
└── output/
└── console.py # Rich console rendering
Author
Sanjay S — Senior DevOps Engineer
GitHub · Portfolio
License
MIT License — see LICENSE for details.
Metadata
Release files for tf-module-scaffolder 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tf_module_scaffolder-1.0.0.tar.gz | 24.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tf_module_scaffolder-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.1 kB
Release files / tf_module_scaffolder-1.0.0.tar.gz
| Download URL | tf_module_scaffolder-1.0.0.tar.gz |
|---|---|
| Size | 24.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
994fa37c3fade5af0a1a9066aa0bd310362be890d124efe0b5576426500589b1
|
|
BLAKE2b-256 checksum How to use checksums |
c9b2002b98b9f894fe7721e17bcad64bf5383ee4edbed81c530e58ba36ba0c90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / tf_module_scaffolder-1.0.0-py3-none-any.whl
| Download URL | tf_module_scaffolder-1.0.0-py3-none-any.whl |
|---|---|
| Size | 23.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c3977c80e800f637540262915c0cafe287b86beba3750153172240ff40a8aaf
|
|
BLAKE2b-256 checksum How to use checksums |
24d97dd9b69411402e88a0cbf5b85b1ba4dcf477b300c6ba311681d54f7cbe97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for tf-module-scaffolder 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.