Skip to content
👷 The Terragrunt website redesign is Work In Progress! 👷
For a list of outstanding TODOs see this.
To give feedback, click here.

render

Usage

Generate a simplified version of the Terragrunt configuration with all includes and dependencies resolved.

Examples

Render the configurations for the current unit in JSON format.

Terminal window
terragrunt render --format=json

Render the Terragrunt configuration in the current working directory, with as much work done as possible beforehand (that is, with all includes merged, dependencies resolved/interpolated, function calls executed, etc).

The only supported format at the moment is JSON, but support for HCL will be added in a future version.

Example:

The following terragrunt.hcl:

locals {
aws_region = "us-east-1"
}
inputs = {
aws_region = local.aws_region
}

Renders to the following HCL by default:

Terminal window
$ terragrunt render
locals {
aws_region = "us-east-1"
}
inputs = {
aws_region = "us-east-1"
}

Note the resolution of the aws_region local, making it easier to read the final evaluated configuration at a glance.

Renders to the following JSON when the --format json flag is used:

Terminal window
$ terragrunt render --format json
{
"locals": { "aws_region": "us-east-1" },
"inputs": { "aws_region": "us-east-1" }
// NOTE: other attributes are omitted for brevity
}

You can also use the --write flag to write the rendered configuration to a canonically named file in the same working directory as the terragrunt.hcl file.

Example:

Terminal window
# Note the use of the `--json` shortcut flag.
terragrunt render --json --write

This will write the rendered configuration to terragrunt.rendered.json in the current working directory.

This can be useful when rendering many configurations in a given directory, and you want to keep the rendered configurations in the same directory as the original configurations, without leveraging external tools or scripts.

This is also useful when combined with the --all flag, which will render all configurations discovered from the current working directory.

Terminal window
# Note the use of the `-w` alias for the `--write` flag.
terragrunt render --all --json -w

This will render all configurations discovered from the current working directory and write the rendered configurations to terragrunt.rendered.json files adjacent to the configurations they are derived from.

Flags

--format

Use the specified format for the rendered configuration. Supported values (hcl, json). default hcl.

Controls the output format of the rendered Terragrunt configuration. Supports:

  • hcl - Output in HCL format (default)
  • json - Output in JSON format

The HCL format is human-readable and matches the original configuration style, while JSON format is useful for programmatic processing.

Example:

Terminal window
# Render as HCL (default)
terragrunt render
# Render as JSON
terragrunt render --format json
Type: string

Environment Variables:

  • TG_FORMAT

--write

Write the rendered configuration to a file (terragrunt.rendered.hcl or terragrunt.rendered.json by default).

Example:

Terminal window
terragrunt render --write --json

This will write the rendered configuration to terragrunt.rendered.json in the current working directory.

Type: boolean

Aliases:

  • w

Environment Variables:

  • TG_WRITE

--all

Render all configurations discovered from the current working directory.

Example:

Terminal window
terragrunt render --all --json

This will render all configurations discovered from the current working directory and write the rendered configurations to terragrunt.rendered.json files adjacent to the configurations they are derived from.

Combining this with the --write flag will write the rendered configurations to terragrunt.rendered.json files adjacent to the configurations they are derived from.

Terminal window
terragrunt render -a --json --write
Type: boolean

Aliases:

  • a

Environment Variables:

  • TG_ALL