docs/src/data/commands/exec.mdx
run and execIn contrast to the run command, which will always invoke OpenTofu/Terraform, the exec command allows for execution of any arbitrary command via Terragrunt.
This can be useful, as it allows you full control over the process that is being orchestrated by Terragrunt, while taking advantage of Terragrunt's features such as dependency resolution, inputs, and more.
When using exec, you will have almost the exact same configuration context that you have when using run, including inputs.
# terragrunt.hcl
inputs = {
message = "Hello, Terragrunt!"
}
Running the following command will show that the message input is available to the command:
$ terragrunt exec -- env | grep 'TF_VAR_message'
TF_VAR_message=Hello, Terragrunt!