Skip to content

get_terraform_cli_args

unitstack

Usage

get_terraform_cli_args() --> list(string)

get_terraform_cli_args returns the command first, then the arguments passed after it. Unlike get_terraform_command, it keeps the command as given, so apply -destroy returns ["apply", "-destroy"].

terragrunt.hcl
locals {
saving_plan = anytrue([
for arg in get_terraform_cli_args() : startswith(arg, "-out=")
])
}

Examples

During terragrunt run -- plan -out=tf.plan.

terragrunt.hcl
inputs = {
cli_args = get_terraform_cli_args() # ["plan", "-out=tf.plan"]
}