Skip to main content

🔨 Stack Forge

CI Python 3.12+ License: MIT Code style: ruff

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

  1. Use environments - Create separate stacks for dev/staging/prod
  2. DRY with Terragrunt - Enable use_terragrunt: true for DRY configs
  3. Consistent naming - Use descriptive stack and resource names
  4. Tag everything - Define global_tags in 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


⭐ If you find this useful, please star the repository!

Metadata

Release files for stack-forge-infra 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stack-forge-infra 0.1.0
File Size Uploaded
stack_forge_infra-0.1.0.tar.gz 32.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stack-forge-infra 0.1.0
File Interpreter ABI Platform
stack_forge_infra-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 73.5 kB

Release files / stack_forge_infra-0.1.0.tar.gz

Download URL stack_forge_infra-0.1.0.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
72098a28c47a3ca3e240581cf5375cc0133a21fa565ad3d27a5c9b4ab30c112a
BLAKE2b-256 checksum
How to use checksums
1cfa131bffd2054dff55582e955453b02574a16950a044830cef87998bb98448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

Release files / stack_forge_infra-0.1.0-py3-none-any.whl

Download URL stack_forge_infra-0.1.0-py3-none-any.whl
Size 40.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
040f0b1745c284454f6cbd4564ed8f903b62cc6c8d6e2496268f509f16806769
BLAKE2b-256 checksum
How to use checksums
38c759c30c78795d0d67d36ad3099aa6d52863304d80aa510563b5589ea839b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page