Generate documented terragrunt.hcl manifests from Terraform module variables.
Project description
terragrunt-generator
terragrunt-generator generates terragrunt.hcl configuration files — with
documented inputs — from the variables exposed by a Terraform module. Point it
at a module (a git repository or a local directory), tell it where to look up
values, and it emits a ready-to-edit Terragrunt manifest plus an optional YAML
config skeleton.
Documentation
The project site is published from main to GitHub Pages:
https://goabonga.github.io/terragrunt-generator/.
Requirements
- Python 3.13+
Installation
pip install terragrunt-generator
Or run it without installing, using uv:
uvx terragrunt-generator --help
Usage
terragrunt-generator \
-u https://github.com/terraform-google-modules/terraform-google-project-factory.git \
-v v14.2.1 \
-l 'project'
This reads the module's variable blocks and prints a terragrunt.hcl whose
inputs are wired to a yamldecode-based config lookup:
# terraform-google-modules v14.2.1
# https://github.com/terraform-google-modules/terraform-google-project-factory/tree/v14.2.1/
include {
path = find_in_parent_folders()
}
locals {
source = "github.com/terraform-google-modules/terraform-google-project-factory.git?ref=v14.2.1"
all = merge(
yamldecode(file(find_in_parent_folders("config.yaml"))),
)
}
terraform {
source = lookup(local.all, "project", false) == false ? null : lookup(local.all.project, "enabled", false) == false ? null : local.source
}
inputs = merge({
billing_account = lookup(local.all.project, "billing_account", "")
name = lookup(local.all.project, "name", "")
org_id = lookup(local.all.project, "org_id", "")
activate_api_identities = lookup(local.all.project, "activate_api_identities", [])
activate_apis = lookup(local.all.project, "activate_apis", ["compute.googleapis.com"])
})
See the usage guide for the full option reference and the per-environment YAML workflow.
Development
git clone https://github.com/goabonga/terragrunt-generator.git
cd terragrunt-generator
uv sync
# Quality gates (mirrored in CI).
uv run ruff check src tests
uv run ruff format --check src tests
uv run mypy src
uv run pytest --cov=terragrunt_generator
# Install the pre-commit + commit-msg hooks.
uv run pre-commit install
Versioning and release
Releases are automated. Every push to main runs
multicz bump --commit --tag --push — driven by
Conventional Commits — then publishes
to PyPI and deploys the docs.
# Preview the next release against the current branch.
multicz status
Contributing
See CONTRIBUTING.md for the workflow, the commit-message convention, and the test/lint expectations. By participating you agree to the Code of Conduct.
Security issues: please follow the disclosure process in SECURITY.md.
License
Distributed under the MIT License.
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 terragrunt_generator-1.0.0.tar.gz.
File metadata
- Download URL: terragrunt_generator-1.0.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a330249546fc1d480ef7b99bb1cf7018dde19cf7522dd8c47bc1b0cc01fe706
|
|
| MD5 |
7be449f5e6de4f0368927e0a648daecf
|
|
| BLAKE2b-256 |
9ff92e7315d866634058e0ad3c450202803630a0838e547c04741a45d29a904b
|
File details
Details for the file terragrunt_generator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: terragrunt_generator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6acdd2b5a185677e76f393b05977786891ad10dab6dc69d9938680e1d75d3205
|
|
| MD5 |
1ce3c04628d65ce034b2914023699cd4
|
|
| BLAKE2b-256 |
5f74ad2cad988030c3c94b4aaa56e7a5611be45226ca3da4174b57eba6505483
|