Terragen is a framework for generating and automatically applying Terraform modules to simplify the management of sophisticated Cloud Architectures
- Simplify the creation and destruction of infra across multiple accounts and regions, using one command
- Fine grained CLI control, all config elements can be overridden on the CLI
- View generated Terraform files before they are applied. Each run creates a timestamped output directory
- Control common and app specific infra separately. Infra that is shared, eg VPCs, Databases can be controlled separately but still referenced by app specific infra
- Create default config files you can "sub-class" for specific implementations, allows you to enforce config patterns across your estate
- Boiler plate Terraform files, like config, tfvars automatically generated
- Variable interpolation. You can lookup values from other config files.
Terragen can be installed via pip:
pip install terragen
Full details on configuring and running Terragen on ReadTheDocs
Terragen expects to be run in its own workspace containing its configuration and the Terraform modules you want to configure and apply.
Once configured as defined in docs, Terragen is very powerful. Below we demonstrate some commands
Terragen lets you define multiple apps and configs, just apply them by name
terragen --config-dir ./config --config-name sandbox
Terragen lets you create the same infrastructure across multiple accounts by supplying the environment you want to deploy to
terragen --config-dir ./config build.environment=test
Validate and resolve your config before you run it.
terragen -cd ./config --cfg job --resolve
You can enable verbose debug logging by passing the following:
terragen -cd ./config hydra.verbose=true