Terragrunt

Terragrunt is an open-source wrapper around Terraform and OpenTofu that organizations use to help keep code DRY. If used in Scalr, Scalr will use all of the Terragrunt commands on top of Terraform or OpenTofu, depending on the pipeline settings.

Configuration

To add Terragrunt, go to the account scope in Scalr, the integrations page, and select Terragrunt. Once selected, it can be enabled for the entire account for use:

There are optional checks that can be enabled for all workspaces that are using Terragrunt:

  • terragrunt hclvalidate - Finds all hcl files from the config stack and validates them.
  • terragrunt hclfmt - Recursively find hcl files and rewrite them into a canonical format with the check mode enabled.
  • terragrunt validate-inputs - Checks if the Terragrunt configured inputs align with the Terraform defined variables.

It will be available to all workspaces once the changes are saved.

Using Terragrunt

End users have the choice to enable Terragrunt at the workspace when creating a workspace or by updating the pipeline afterward. When creating a workspace, users are prompted to select the IaC platform (Terraform or OpenTofu and whether or not it should run with Terragrunt:

If Terragrunt is being added after a workspace has already been created, it can be added in the pipeline settings:

Users will see in the run that Terragrunt is being used to execute the commands: