stack-forge-infra 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. stack_forge_infra-0.1.0/.github/workflows/ci.yml +35 -0
  2. stack_forge_infra-0.1.0/.github/workflows/release.yml +142 -0
  3. stack_forge_infra-0.1.0/.gitignore +49 -0
  4. stack_forge_infra-0.1.0/LICENSE +21 -0
  5. stack_forge_infra-0.1.0/PKG-INFO +240 -0
  6. stack_forge_infra-0.1.0/README.md +203 -0
  7. stack_forge_infra-0.1.0/RELEASING.md +105 -0
  8. stack_forge_infra-0.1.0/examples/dynamodb.yaml +46 -0
  9. stack_forge_infra-0.1.0/examples/ecr.yaml +48 -0
  10. stack_forge_infra-0.1.0/examples/eks.yaml +26 -0
  11. stack_forge_infra-0.1.0/examples/forge.yaml +161 -0
  12. stack_forge_infra-0.1.0/examples/full_stack.yaml +281 -0
  13. stack_forge_infra-0.1.0/examples/iam_role.yaml +44 -0
  14. stack_forge_infra-0.1.0/examples/lambda.yaml +64 -0
  15. stack_forge_infra-0.1.0/examples/rds.yaml +66 -0
  16. stack_forge_infra-0.1.0/examples/s3_bucket.yaml +32 -0
  17. stack_forge_infra-0.1.0/examples/secrets_manager.yaml +50 -0
  18. stack_forge_infra-0.1.0/examples/security_group.yaml +34 -0
  19. stack_forge_infra-0.1.0/examples/vpc.yaml +27 -0
  20. stack_forge_infra-0.1.0/pyproject.toml +90 -0
  21. stack_forge_infra-0.1.0/src/stack_forge/__init__.py +20 -0
  22. stack_forge_infra-0.1.0/src/stack_forge/_version.py +34 -0
  23. stack_forge_infra-0.1.0/src/stack_forge/cli.py +450 -0
  24. stack_forge_infra-0.1.0/src/stack_forge/engine.py +365 -0
  25. stack_forge_infra-0.1.0/src/stack_forge/models.py +169 -0
  26. stack_forge_infra-0.1.0/src/stack_forge/templates/dynamodb/main.tf.j2 +151 -0
  27. stack_forge_infra-0.1.0/src/stack_forge/templates/dynamodb/outputs.tf.j2 +37 -0
  28. stack_forge_infra-0.1.0/src/stack_forge/templates/dynamodb/variables.tf.j2 +148 -0
  29. stack_forge_infra-0.1.0/src/stack_forge/templates/ecr/main.tf.j2 +82 -0
  30. stack_forge_infra-0.1.0/src/stack_forge/templates/ecr/outputs.tf.j2 +22 -0
  31. stack_forge_infra-0.1.0/src/stack_forge/templates/ecr/variables.tf.j2 +84 -0
  32. stack_forge_infra-0.1.0/src/stack_forge/templates/eks/main.tf.j2 +179 -0
  33. stack_forge_infra-0.1.0/src/stack_forge/templates/eks/outputs.tf.j2 +64 -0
  34. stack_forge_infra-0.1.0/src/stack_forge/templates/eks/variables.tf.j2 +82 -0
  35. stack_forge_infra-0.1.0/src/stack_forge/templates/generic/main.tf.j2 +18 -0
  36. stack_forge_infra-0.1.0/src/stack_forge/templates/iam_role/main.tf.j2 +74 -0
  37. stack_forge_infra-0.1.0/src/stack_forge/templates/iam_role/outputs.tf.j2 +32 -0
  38. stack_forge_infra-0.1.0/src/stack_forge/templates/iam_role/variables.tf.j2 +94 -0
  39. stack_forge_infra-0.1.0/src/stack_forge/templates/lambda/main.tf.j2 +175 -0
  40. stack_forge_infra-0.1.0/src/stack_forge/templates/lambda/outputs.tf.j2 +42 -0
  41. stack_forge_infra-0.1.0/src/stack_forge/templates/lambda/variables.tf.j2 +165 -0
  42. stack_forge_infra-0.1.0/src/stack_forge/templates/rds/main.tf.j2 +170 -0
  43. stack_forge_infra-0.1.0/src/stack_forge/templates/rds/outputs.tf.j2 +48 -0
  44. stack_forge_infra-0.1.0/src/stack_forge/templates/rds/variables.tf.j2 +170 -0
  45. stack_forge_infra-0.1.0/src/stack_forge/templates/s3_bucket/main.tf.j2 +71 -0
  46. stack_forge_infra-0.1.0/src/stack_forge/templates/s3_bucket/outputs.tf.j2 +22 -0
  47. stack_forge_infra-0.1.0/src/stack_forge/templates/s3_bucket/variables.tf.j2 +36 -0
  48. stack_forge_infra-0.1.0/src/stack_forge/templates/secrets_manager/main.tf.j2 +79 -0
  49. stack_forge_infra-0.1.0/src/stack_forge/templates/secrets_manager/outputs.tf.j2 +27 -0
  50. stack_forge_infra-0.1.0/src/stack_forge/templates/secrets_manager/variables.tf.j2 +88 -0
  51. stack_forge_infra-0.1.0/src/stack_forge/templates/security_group/main.tf.j2 +59 -0
  52. stack_forge_infra-0.1.0/src/stack_forge/templates/security_group/outputs.tf.j2 +22 -0
  53. stack_forge_infra-0.1.0/src/stack_forge/templates/security_group/variables.tf.j2 +77 -0
  54. stack_forge_infra-0.1.0/src/stack_forge/templates/vpc/main.tf.j2 +203 -0
  55. stack_forge_infra-0.1.0/src/stack_forge/templates/vpc/outputs.tf.j2 +47 -0
  56. stack_forge_infra-0.1.0/src/stack_forge/templates/vpc/variables.tf.j2 +54 -0
  57. stack_forge_infra-0.1.0/tests/__init__.py +1 -0
  58. stack_forge_infra-0.1.0/tests/test_models.py +29 -0
@@ -0,0 +1,35 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0 # hatch-vcs needs full history to derive the version
17
+
18
+ - name: Set up Python 3.12
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install -e ".[dev]"
27
+
28
+ - name: Lint with ruff
29
+ run: |
30
+ ruff check src/
31
+ ruff format src/ --check
32
+
33
+ - name: Run tests
34
+ run: |
35
+ pytest tests/ -v --tb=short
@@ -0,0 +1,142 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v[0-9]+.[0-9]+.[0-9]+"
7
+ - "v[0-9]+.[0-9]+.[0-9]+-*" # pre-releases: v1.2.3-alpha.1
8
+
9
+ permissions:
10
+ contents: write # create GitHub Releases
11
+ id-token: write # PyPI trusted publishing (OIDC)
12
+
13
+ jobs:
14
+ # โ”€โ”€ 1. Validate the tag format โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
15
+ validate-tag:
16
+ name: Validate tag
17
+ runs-on: ubuntu-latest
18
+ outputs:
19
+ version: ${{ steps.parse.outputs.version }}
20
+ prerelease: ${{ steps.parse.outputs.prerelease }}
21
+ steps:
22
+ - name: Parse tag
23
+ id: parse
24
+ run: |
25
+ TAG="${GITHUB_REF_NAME}"
26
+ VERSION="${TAG#v}"
27
+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
28
+ if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
29
+ echo "prerelease=false" >> "$GITHUB_OUTPUT"
30
+ else
31
+ echo "prerelease=true" >> "$GITHUB_OUTPUT"
32
+ fi
33
+ echo "Releasing: ${TAG} (pre-release: $([[ '$TAG' =~ - ]] && echo true || echo false))"
34
+
35
+ # โ”€โ”€ 2. Run test suite โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
36
+ test:
37
+ name: Test (Python ${{ matrix.python-version }})
38
+ runs-on: ubuntu-latest
39
+ needs: validate-tag
40
+ strategy:
41
+ matrix:
42
+ python-version: ["3.12", "3.13"]
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+ with:
46
+ fetch-depth: 0 # hatch-vcs needs full history to derive version
47
+
48
+ - name: Set up Python ${{ matrix.python-version }}
49
+ uses: actions/setup-python@v5
50
+ with:
51
+ python-version: ${{ matrix.python-version }}
52
+
53
+ - name: Install dependencies
54
+ run: |
55
+ python -m pip install --upgrade pip
56
+ pip install -e ".[dev]"
57
+
58
+ - name: Lint
59
+ run: |
60
+ ruff check src/
61
+ ruff format src/ --check
62
+
63
+ - name: Run tests
64
+ run: pytest tests/ -v --tb=short
65
+
66
+ # โ”€โ”€ 3. Build distribution โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
67
+ build:
68
+ name: Build distribution
69
+ runs-on: ubuntu-latest
70
+ needs: test
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+ with:
74
+ fetch-depth: 0
75
+
76
+ - name: Set up Python
77
+ uses: actions/setup-python@v5
78
+ with:
79
+ python-version: "3.12"
80
+
81
+ - name: Install build tools
82
+ run: pip install --upgrade build hatch-vcs
83
+
84
+ - name: Build wheel and sdist
85
+ run: python -m build
86
+
87
+ - name: Verify the build
88
+ run: |
89
+ pip install twine
90
+ twine check dist/*
91
+
92
+ - name: Upload dist artifacts
93
+ uses: actions/upload-artifact@v4
94
+ with:
95
+ name: dist
96
+ path: dist/
97
+
98
+ # โ”€โ”€ 4. Publish to PyPI โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
99
+ publish-pypi:
100
+ name: Publish to PyPI
101
+ runs-on: ubuntu-latest
102
+ needs: build
103
+ environment:
104
+ name: pypi
105
+ url: https://pypi.org/p/stack-forge-infra
106
+ steps:
107
+ - name: Download dist artifacts
108
+ uses: actions/download-artifact@v4
109
+ with:
110
+ name: dist
111
+ path: dist/
112
+
113
+ - name: Publish to PyPI
114
+ uses: pypa/gh-action-pypi-publish@release/v1
115
+ # Uses OIDC trusted publishing โ€” no API token needed.
116
+ # Configure a trusted publisher at https://pypi.org/manage/project/stack-forge-infra/settings/publishing/
117
+ # with: publisher = GitHub Actions, workflow = release.yml, environment = pypi
118
+
119
+ # โ”€โ”€ 5. Create GitHub Release โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
120
+ github-release:
121
+ name: Create GitHub Release
122
+ runs-on: ubuntu-latest
123
+ needs: [validate-tag, publish-pypi]
124
+ steps:
125
+ - uses: actions/checkout@v4
126
+ with:
127
+ fetch-depth: 0
128
+
129
+ - name: Download dist artifacts
130
+ uses: actions/download-artifact@v4
131
+ with:
132
+ name: dist
133
+ path: dist/
134
+
135
+ - name: Create GitHub Release
136
+ uses: softprops/action-gh-release@v2
137
+ with:
138
+ name: "v${{ needs.validate-tag.outputs.version }}"
139
+ tag_name: ${{ github.ref_name }}
140
+ prerelease: ${{ needs.validate-tag.outputs.prerelease }}
141
+ generate_release_notes: true
142
+ files: dist/*
@@ -0,0 +1,49 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Auto-generated by hatch-vcs โ€” do not commit
13
+ src/stack_forge/_version.py
14
+
15
+ # Virtual environments
16
+ .venv/
17
+ venv/
18
+ ENV/
19
+
20
+ # IDE
21
+ .idea/
22
+ .vscode/
23
+ *.swp
24
+ *.swo
25
+
26
+ # Testing
27
+ .pytest_cache/
28
+ .coverage
29
+ htmlcov/
30
+
31
+ # mypy
32
+ .mypy_cache/
33
+
34
+ # Ruff
35
+ .ruff_cache/
36
+
37
+ # OS
38
+ .DS_Store
39
+ Thumbs.db
40
+
41
+ # Generated infrastructure (keep examples)
42
+ infrastructure/
43
+ !examples/
44
+
45
+ # Terraform
46
+ *.tfstate
47
+ *.tfstate.*
48
+ .terraform/
49
+ .terraform.lock.hcl
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Praneeth Turlapati
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,240 @@
1
+ Metadata-Version: 2.4
2
+ Name: stack-forge-infra
3
+ Version: 0.1.0
4
+ Summary: Self-Service Infrastructure Templating Engine for Terraform & Terragrunt
5
+ Project-URL: Homepage, https://github.com/pt1691/stack-forge
6
+ Project-URL: Repository, https://github.com/pt1691/stack-forge
7
+ Project-URL: Issues, https://github.com/pt1691/stack-forge/issues
8
+ Author-email: Praneeth Turlapati <praneeth1691@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: automation,aws,cli,devops,iac,infrastructure-as-code,templates,terraform,terragrunt
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Code Generators
21
+ Classifier: Topic :: System :: Systems Administration
22
+ Requires-Python: >=3.12
23
+ Requires-Dist: jinja2>=3.0.0
24
+ Requires-Dist: pydantic-settings>=2.0.0
25
+ Requires-Dist: pydantic>=2.0.0
26
+ Requires-Dist: python-hcl2>=4.0.0
27
+ Requires-Dist: pyyaml>=6.0.0
28
+ Requires-Dist: rich>=13.0.0
29
+ Requires-Dist: typer>=0.9.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: hatch-vcs>=0.4.0; extra == 'dev'
32
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # ๐Ÿ”จ Stack Forge
39
+
40
+ [![CI](https://github.com/pt1691/stack-forge/actions/workflows/ci.yml/badge.svg)](https://github.com/pt1691/stack-forge/actions/workflows/ci.yml)
41
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
44
+
45
+ > **Self-Service Infrastructure Templating Engine for Terraform & Terragrunt**
46
+
47
+ A CLI tool that generates production-ready Terraform and Terragrunt configurations from reusable templates. Stop writing boilerplate infrastructure code and start deploying in minutes.
48
+
49
+ ## โšก 30-Second Quick Start
50
+
51
+ ```bash
52
+ git clone https://github.com/pt1691/stack-forge.git && cd stack-forge
53
+ python3 -m venv .venv && source .venv/bin/activate
54
+ pip install -e .
55
+ forge list-templates # See available templates!
56
+ ```
57
+
58
+ **That's it!** Now create your first infrastructure:
59
+
60
+ ```bash
61
+ mkdir my-infra && cd my-infra
62
+ forge init --name my-app --org mycompany
63
+ forge add-stack --name network --env dev
64
+ forge add-resource --stack network --name main-vpc --type vpc
65
+ forge generate # Creates Terraform files!
66
+ ```
67
+
68
+ ---
69
+
70
+ ## โœจ Features
71
+
72
+ - ๐Ÿš€ **Quick Setup** - Generate complete infrastructure stacks with a few commands
73
+ - ๐Ÿ“ฆ **Pre-built Templates** - VPC, EKS, S3, RDS, Lambda, and more
74
+ - ๐Ÿ”ง **Terragrunt Support** - DRY configurations with Terragrunt integration
75
+ - ๐Ÿท๏ธ **Consistent Tagging** - Automatic resource tagging across all resources
76
+ - ๐Ÿ”’ **Security Best Practices** - Templates follow AWS security guidelines
77
+ - ๐Ÿ“ **Customizable** - Extend with your own templates
78
+
79
+ ## ๐Ÿš€ Installation
80
+
81
+ ```bash
82
+ git clone https://github.com/pt1691/stack-forge.git
83
+ cd stack-forge
84
+ python3 -m venv .venv
85
+ source .venv/bin/activate
86
+ pip install -e .
87
+ ```
88
+
89
+ ## ๐Ÿ“– Workflow Example
90
+
91
+ ```bash
92
+ # 1. Create a new project
93
+ mkdir my-platform && cd my-platform
94
+ forge init --name my-platform --org acmecorp
95
+
96
+ # 2. Add a stack (environment + resource group)
97
+ forge add-stack --name network --env dev
98
+
99
+ # 3. Add resources to the stack
100
+ forge add-resource --stack network --name main-vpc --type vpc
101
+ forge add-resource --stack network --name logs --type s3_bucket
102
+
103
+ # 4. Generate Terraform files
104
+ forge generate
105
+
106
+ # 5. Review what was created
107
+ tree infrastructure/
108
+ ```
109
+
110
+ ## ๐Ÿ“‹ Commands
111
+
112
+ | Command | Description |
113
+ |---------|-------------|
114
+ | `forge init` | Initialize a new Stack Forge project |
115
+ | `forge add-stack` | Add a new infrastructure stack |
116
+ | `forge add-resource` | Add a resource to a stack |
117
+ | `forge generate` | Generate Terraform/Terragrunt files |
118
+ | `forge show` | Show project configuration |
119
+ | `forge validate` | Validate configuration |
120
+ | `forge list-templates` | List available templates |
121
+
122
+ ## ๐Ÿ“ฆ Available Templates
123
+
124
+ | Template | Description |
125
+ |----------|-------------|
126
+ | `vpc` | VPC with public/private subnets, NAT gateways, flow logs |
127
+ | `s3_bucket` | S3 bucket with versioning, encryption, lifecycle rules |
128
+ | `eks` | EKS cluster with managed node groups, IRSA, encryption |
129
+ | `rds` | RDS instance with Multi-AZ, automated backups |
130
+ | `dynamodb` | DynamoDB table with auto-scaling |
131
+ | `lambda` | Lambda function with IAM role, CloudWatch logs |
132
+ | `iam_role` | IAM role with customizable policies |
133
+ | `security_group` | Security group with configurable rules |
134
+ | `secrets_manager` | Secrets Manager with rotation |
135
+ | `ecr` | ECR repository with lifecycle policies |
136
+
137
+ ## ๐Ÿ“ Generated Structure
138
+
139
+ ```
140
+ infrastructure/
141
+ โ”œโ”€โ”€ network/
142
+ โ”‚ โ”œโ”€โ”€ providers.tf # AWS provider configuration
143
+ โ”‚ โ”œโ”€โ”€ backend.tf # S3 backend for state
144
+ โ”‚ โ”œโ”€โ”€ main.tf # Module calls
145
+ โ”‚ โ”œโ”€โ”€ terragrunt.hcl # Terragrunt configuration
146
+ โ”‚ โ””โ”€โ”€ modules/
147
+ โ”‚ โ”œโ”€โ”€ main-vpc/
148
+ โ”‚ โ”‚ โ”œโ”€โ”€ main.tf
149
+ โ”‚ โ”‚ โ”œโ”€โ”€ variables.tf
150
+ โ”‚ โ”‚ โ””โ”€โ”€ outputs.tf
151
+ โ”‚ โ””โ”€โ”€ logs/
152
+ โ”‚ โ”œโ”€โ”€ main.tf
153
+ โ”‚ โ”œโ”€โ”€ variables.tf
154
+ โ”‚ โ””โ”€โ”€ outputs.tf
155
+ ```
156
+
157
+ ## โš™๏ธ Configuration (forge.yaml)
158
+
159
+ ```yaml
160
+ version: "1.0"
161
+ name: my-platform
162
+ organization: mycompany
163
+ default_provider: aws
164
+ default_region: us-west-2
165
+ environments:
166
+ - dev
167
+ - staging
168
+ - prod
169
+
170
+ stacks:
171
+ - name: network
172
+ environment: dev
173
+ region: us-west-2
174
+ use_terragrunt: true
175
+ resources:
176
+ - name: main-vpc
177
+ type: vpc
178
+ variables:
179
+ vpc_cidr: "10.0.0.0/16"
180
+ az_count: 3
181
+ enable_nat_gateway: true
182
+
183
+ - name: logs
184
+ type: s3_bucket
185
+ variables:
186
+ versioning_enabled: true
187
+ ```
188
+
189
+ ## ๐Ÿ”ง Custom Templates
190
+
191
+ Add your own templates in `~/.stack-forge/templates/`:
192
+
193
+ ```
194
+ ~/.stack-forge/templates/
195
+ โ””โ”€โ”€ my_custom_resource/
196
+ โ”œโ”€โ”€ main.tf.j2
197
+ โ”œโ”€โ”€ variables.tf.j2
198
+ โ””โ”€โ”€ outputs.tf.j2
199
+ ```
200
+
201
+ Templates use Jinja2 with these available variables:
202
+ - `{{ name }}` - Resource name
203
+ - `{{ environment }}` - Environment (dev/staging/prod)
204
+ - `{{ region }}` - AWS region
205
+ - `{{ variables }}` - Resource-specific variables
206
+ - `{{ tags }}` - Merged tags
207
+
208
+ ## ๐Ÿ“ Best Practices
209
+
210
+ 1. **Use environments** - Create separate stacks for dev/staging/prod
211
+ 2. **DRY with Terragrunt** - Enable `use_terragrunt: true` for DRY configs
212
+ 3. **Consistent naming** - Use descriptive stack and resource names
213
+ 4. **Tag everything** - Define `global_tags` in your project config
214
+
215
+ ## ๐Ÿงช Development
216
+
217
+ ```bash
218
+ # Install dev dependencies
219
+ pip install -e ".[dev]"
220
+
221
+ # Run tests
222
+ pytest
223
+
224
+ # Run linter
225
+ ruff check .
226
+ ```
227
+
228
+ ## ๐Ÿ“ License
229
+
230
+ MIT License - see [LICENSE](LICENSE) for details.
231
+
232
+ ## ๐Ÿ™‹โ€โ™‚๏ธ Author
233
+
234
+ **Praneeth Turlapati**
235
+ - LinkedIn: [linkedin.com/in/praneeth-turlapati](https://linkedin.com/in/praneeth-turlapati)
236
+ - GitHub: [github.com/pt1691](https://github.com/pt1691)
237
+
238
+ ---
239
+
240
+ โญ **If you find this useful, please star the repository!**
@@ -0,0 +1,203 @@
1
+ # ๐Ÿ”จ Stack Forge
2
+
3
+ [![CI](https://github.com/pt1691/stack-forge/actions/workflows/ci.yml/badge.svg)](https://github.com/pt1691/stack-forge/actions/workflows/ci.yml)
4
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
7
+
8
+ > **Self-Service Infrastructure Templating Engine for Terraform & Terragrunt**
9
+
10
+ A CLI tool that generates production-ready Terraform and Terragrunt configurations from reusable templates. Stop writing boilerplate infrastructure code and start deploying in minutes.
11
+
12
+ ## โšก 30-Second Quick Start
13
+
14
+ ```bash
15
+ git clone https://github.com/pt1691/stack-forge.git && cd stack-forge
16
+ python3 -m venv .venv && source .venv/bin/activate
17
+ pip install -e .
18
+ forge list-templates # See available templates!
19
+ ```
20
+
21
+ **That's it!** Now create your first infrastructure:
22
+
23
+ ```bash
24
+ mkdir my-infra && cd my-infra
25
+ forge init --name my-app --org mycompany
26
+ forge add-stack --name network --env dev
27
+ forge add-resource --stack network --name main-vpc --type vpc
28
+ forge generate # Creates Terraform files!
29
+ ```
30
+
31
+ ---
32
+
33
+ ## โœจ Features
34
+
35
+ - ๐Ÿš€ **Quick Setup** - Generate complete infrastructure stacks with a few commands
36
+ - ๐Ÿ“ฆ **Pre-built Templates** - VPC, EKS, S3, RDS, Lambda, and more
37
+ - ๐Ÿ”ง **Terragrunt Support** - DRY configurations with Terragrunt integration
38
+ - ๐Ÿท๏ธ **Consistent Tagging** - Automatic resource tagging across all resources
39
+ - ๐Ÿ”’ **Security Best Practices** - Templates follow AWS security guidelines
40
+ - ๐Ÿ“ **Customizable** - Extend with your own templates
41
+
42
+ ## ๐Ÿš€ Installation
43
+
44
+ ```bash
45
+ git clone https://github.com/pt1691/stack-forge.git
46
+ cd stack-forge
47
+ python3 -m venv .venv
48
+ source .venv/bin/activate
49
+ pip install -e .
50
+ ```
51
+
52
+ ## ๐Ÿ“– Workflow Example
53
+
54
+ ```bash
55
+ # 1. Create a new project
56
+ mkdir my-platform && cd my-platform
57
+ forge init --name my-platform --org acmecorp
58
+
59
+ # 2. Add a stack (environment + resource group)
60
+ forge add-stack --name network --env dev
61
+
62
+ # 3. Add resources to the stack
63
+ forge add-resource --stack network --name main-vpc --type vpc
64
+ forge add-resource --stack network --name logs --type s3_bucket
65
+
66
+ # 4. Generate Terraform files
67
+ forge generate
68
+
69
+ # 5. Review what was created
70
+ tree infrastructure/
71
+ ```
72
+
73
+ ## ๐Ÿ“‹ Commands
74
+
75
+ | Command | Description |
76
+ |---------|-------------|
77
+ | `forge init` | Initialize a new Stack Forge project |
78
+ | `forge add-stack` | Add a new infrastructure stack |
79
+ | `forge add-resource` | Add a resource to a stack |
80
+ | `forge generate` | Generate Terraform/Terragrunt files |
81
+ | `forge show` | Show project configuration |
82
+ | `forge validate` | Validate configuration |
83
+ | `forge list-templates` | List available templates |
84
+
85
+ ## ๐Ÿ“ฆ Available Templates
86
+
87
+ | Template | Description |
88
+ |----------|-------------|
89
+ | `vpc` | VPC with public/private subnets, NAT gateways, flow logs |
90
+ | `s3_bucket` | S3 bucket with versioning, encryption, lifecycle rules |
91
+ | `eks` | EKS cluster with managed node groups, IRSA, encryption |
92
+ | `rds` | RDS instance with Multi-AZ, automated backups |
93
+ | `dynamodb` | DynamoDB table with auto-scaling |
94
+ | `lambda` | Lambda function with IAM role, CloudWatch logs |
95
+ | `iam_role` | IAM role with customizable policies |
96
+ | `security_group` | Security group with configurable rules |
97
+ | `secrets_manager` | Secrets Manager with rotation |
98
+ | `ecr` | ECR repository with lifecycle policies |
99
+
100
+ ## ๐Ÿ“ Generated Structure
101
+
102
+ ```
103
+ infrastructure/
104
+ โ”œโ”€โ”€ network/
105
+ โ”‚ โ”œโ”€โ”€ providers.tf # AWS provider configuration
106
+ โ”‚ โ”œโ”€โ”€ backend.tf # S3 backend for state
107
+ โ”‚ โ”œโ”€โ”€ main.tf # Module calls
108
+ โ”‚ โ”œโ”€โ”€ terragrunt.hcl # Terragrunt configuration
109
+ โ”‚ โ””โ”€โ”€ modules/
110
+ โ”‚ โ”œโ”€โ”€ main-vpc/
111
+ โ”‚ โ”‚ โ”œโ”€โ”€ main.tf
112
+ โ”‚ โ”‚ โ”œโ”€โ”€ variables.tf
113
+ โ”‚ โ”‚ โ””โ”€โ”€ outputs.tf
114
+ โ”‚ โ””โ”€โ”€ logs/
115
+ โ”‚ โ”œโ”€โ”€ main.tf
116
+ โ”‚ โ”œโ”€โ”€ variables.tf
117
+ โ”‚ โ””โ”€โ”€ outputs.tf
118
+ ```
119
+
120
+ ## โš™๏ธ Configuration (forge.yaml)
121
+
122
+ ```yaml
123
+ version: "1.0"
124
+ name: my-platform
125
+ organization: mycompany
126
+ default_provider: aws
127
+ default_region: us-west-2
128
+ environments:
129
+ - dev
130
+ - staging
131
+ - prod
132
+
133
+ stacks:
134
+ - name: network
135
+ environment: dev
136
+ region: us-west-2
137
+ use_terragrunt: true
138
+ resources:
139
+ - name: main-vpc
140
+ type: vpc
141
+ variables:
142
+ vpc_cidr: "10.0.0.0/16"
143
+ az_count: 3
144
+ enable_nat_gateway: true
145
+
146
+ - name: logs
147
+ type: s3_bucket
148
+ variables:
149
+ versioning_enabled: true
150
+ ```
151
+
152
+ ## ๐Ÿ”ง Custom Templates
153
+
154
+ Add your own templates in `~/.stack-forge/templates/`:
155
+
156
+ ```
157
+ ~/.stack-forge/templates/
158
+ โ””โ”€โ”€ my_custom_resource/
159
+ โ”œโ”€โ”€ main.tf.j2
160
+ โ”œโ”€โ”€ variables.tf.j2
161
+ โ””โ”€โ”€ outputs.tf.j2
162
+ ```
163
+
164
+ Templates use Jinja2 with these available variables:
165
+ - `{{ name }}` - Resource name
166
+ - `{{ environment }}` - Environment (dev/staging/prod)
167
+ - `{{ region }}` - AWS region
168
+ - `{{ variables }}` - Resource-specific variables
169
+ - `{{ tags }}` - Merged tags
170
+
171
+ ## ๐Ÿ“ Best Practices
172
+
173
+ 1. **Use environments** - Create separate stacks for dev/staging/prod
174
+ 2. **DRY with Terragrunt** - Enable `use_terragrunt: true` for DRY configs
175
+ 3. **Consistent naming** - Use descriptive stack and resource names
176
+ 4. **Tag everything** - Define `global_tags` in your project config
177
+
178
+ ## ๐Ÿงช Development
179
+
180
+ ```bash
181
+ # Install dev dependencies
182
+ pip install -e ".[dev]"
183
+
184
+ # Run tests
185
+ pytest
186
+
187
+ # Run linter
188
+ ruff check .
189
+ ```
190
+
191
+ ## ๐Ÿ“ License
192
+
193
+ MIT License - see [LICENSE](LICENSE) for details.
194
+
195
+ ## ๐Ÿ™‹โ€โ™‚๏ธ Author
196
+
197
+ **Praneeth Turlapati**
198
+ - LinkedIn: [linkedin.com/in/praneeth-turlapati](https://linkedin.com/in/praneeth-turlapati)
199
+ - GitHub: [github.com/pt1691](https://github.com/pt1691)
200
+
201
+ ---
202
+
203
+ โญ **If you find this useful, please star the repository!**