Self-Service Infrastructure Templating Engine for Terraform & Terragrunt
Project description
๐จ Stack Forge
Self-Service Infrastructure Templating Engine for Terraform & Terragrunt
A CLI tool that generates production-ready Terraform and Terragrunt configurations from reusable templates. Stop writing boilerplate infrastructure code and start deploying in minutes.
โก 30-Second Quick Start
git clone https://github.com/pt1691/stack-forge.git && cd stack-forge
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
forge list-templates # See available templates!
That's it! Now create your first infrastructure:
mkdir my-infra && cd my-infra
forge init --name my-app --org mycompany
forge add-stack --name network --env dev
forge add-resource --stack network --name main-vpc --type vpc
forge generate # Creates Terraform files!
โจ Features
- ๐ Quick Setup - Generate complete infrastructure stacks with a few commands
- ๐ฆ Pre-built Templates - VPC, EKS, S3, RDS, Lambda, and more
- ๐ง Terragrunt Support - DRY configurations with Terragrunt integration
- ๐ท๏ธ Consistent Tagging - Automatic resource tagging across all resources
- ๐ Security Best Practices - Templates follow AWS security guidelines
- ๐ Customizable - Extend with your own templates
๐ Installation
git clone https://github.com/pt1691/stack-forge.git
cd stack-forge
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
๐ Workflow Example
# 1. Create a new project
mkdir my-platform && cd my-platform
forge init --name my-platform --org acmecorp
# 2. Add a stack (environment + resource group)
forge add-stack --name network --env dev
# 3. Add resources to the stack
forge add-resource --stack network --name main-vpc --type vpc
forge add-resource --stack network --name logs --type s3_bucket
# 4. Generate Terraform files
forge generate
# 5. Review what was created
tree infrastructure/
๐ Commands
| Command | Description |
|---|---|
forge init |
Initialize a new Stack Forge project |
forge add-stack |
Add a new infrastructure stack |
forge add-resource |
Add a resource to a stack |
forge generate |
Generate Terraform/Terragrunt files |
forge show |
Show project configuration |
forge validate |
Validate configuration |
forge list-templates |
List available templates |
๐ฆ Available Templates
| Template | Description |
|---|---|
vpc |
VPC with public/private subnets, NAT gateways, flow logs |
s3_bucket |
S3 bucket with versioning, encryption, lifecycle rules |
eks |
EKS cluster with managed node groups, IRSA, encryption |
rds |
RDS instance with Multi-AZ, automated backups |
dynamodb |
DynamoDB table with auto-scaling |
lambda |
Lambda function with IAM role, CloudWatch logs |
iam_role |
IAM role with customizable policies |
security_group |
Security group with configurable rules |
secrets_manager |
Secrets Manager with rotation |
ecr |
ECR repository with lifecycle policies |
๐ Generated Structure
infrastructure/
โโโ network/
โ โโโ providers.tf # AWS provider configuration
โ โโโ backend.tf # S3 backend for state
โ โโโ main.tf # Module calls
โ โโโ terragrunt.hcl # Terragrunt configuration
โ โโโ modules/
โ โโโ main-vpc/
โ โ โโโ main.tf
โ โ โโโ variables.tf
โ โ โโโ outputs.tf
โ โโโ logs/
โ โโโ main.tf
โ โโโ variables.tf
โ โโโ outputs.tf
โ๏ธ Configuration (forge.yaml)
version: "1.0"
name: my-platform
organization: mycompany
default_provider: aws
default_region: us-west-2
environments:
- dev
- staging
- prod
stacks:
- name: network
environment: dev
region: us-west-2
use_terragrunt: true
resources:
- name: main-vpc
type: vpc
variables:
vpc_cidr: "10.0.0.0/16"
az_count: 3
enable_nat_gateway: true
- name: logs
type: s3_bucket
variables:
versioning_enabled: true
๐ง Custom Templates
Add your own templates in ~/.stack-forge/templates/:
~/.stack-forge/templates/
โโโ my_custom_resource/
โโโ main.tf.j2
โโโ variables.tf.j2
โโโ outputs.tf.j2
Templates use Jinja2 with these available variables:
{{ name }}- Resource name{{ environment }}- Environment (dev/staging/prod){{ region }}- AWS region{{ variables }}- Resource-specific variables{{ tags }}- Merged tags
๐ Best Practices
- Use environments - Create separate stacks for dev/staging/prod
- DRY with Terragrunt - Enable
use_terragrunt: truefor DRY configs - Consistent naming - Use descriptive stack and resource names
- Tag everything - Define
global_tagsin your project config
๐งช Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linter
ruff check .
๐ License
MIT License - see LICENSE for details.
๐โโ๏ธ Author
Praneeth Turlapati
- LinkedIn: linkedin.com/in/praneeth-turlapati
- GitHub: github.com/pt1691
โญ If you find this useful, please star the repository!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stack_forge_infra-0.1.0.tar.gz.
File metadata
- Download URL: stack_forge_infra-0.1.0.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72098a28c47a3ca3e240581cf5375cc0133a21fa565ad3d27a5c9b4ab30c112a
|
|
| MD5 |
cf18eae996988ea7b763fd5501b5c845
|
|
| BLAKE2b-256 |
1cfa131bffd2054dff55582e955453b02574a16950a044830cef87998bb98448
|
Provenance
The following attestation bundles were made for stack_forge_infra-0.1.0.tar.gz:
Publisher:
release.yml on pt1691/stack-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stack_forge_infra-0.1.0.tar.gz -
Subject digest:
72098a28c47a3ca3e240581cf5375cc0133a21fa565ad3d27a5c9b4ab30c112a - Sigstore transparency entry: 992697527
- Sigstore integration time:
-
Permalink:
pt1691/stack-forge@5764d9f90e582218b6e9aac271de28e28fc4f926 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/pt1691
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5764d9f90e582218b6e9aac271de28e28fc4f926 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stack_forge_infra-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stack_forge_infra-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
040f0b1745c284454f6cbd4564ed8f903b62cc6c8d6e2496268f509f16806769
|
|
| MD5 |
e97a8e059a5530a1bb4875af361719c2
|
|
| BLAKE2b-256 |
38c759c30c78795d0d67d36ad3099aa6d52863304d80aa510563b5589ea839b1
|
Provenance
The following attestation bundles were made for stack_forge_infra-0.1.0-py3-none-any.whl:
Publisher:
release.yml on pt1691/stack-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stack_forge_infra-0.1.0-py3-none-any.whl -
Subject digest:
040f0b1745c284454f6cbd4564ed8f903b62cc6c8d6e2496268f509f16806769 - Sigstore transparency entry: 992697528
- Sigstore integration time:
-
Permalink:
pt1691/stack-forge@5764d9f90e582218b6e9aac271de28e28fc4f926 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/pt1691
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5764d9f90e582218b6e9aac271de28e28fc4f926 -
Trigger Event:
push
-
Statement type: