Skip to content

get_terraform_commands_that_need_vars

unitstack

Usage

get_terraform_commands_that_need_vars() --> list(string)

get_terraform_commands_that_need_vars returns apply, console, destroy, import, plan, push, and refresh. Use it as the commands of an extra_arguments block that passes -var or -var-file:

terragrunt.hcl
terraform {
extra_arguments "common_vars" {
commands = get_terraform_commands_that_need_vars()
arguments = ["-var-file=${get_terragrunt_dir()}/../common.tfvars"]
}
}

Examples

terragrunt.hcl
locals {
commands = get_terraform_commands_that_need_vars()
# ["apply", "console", "destroy", "import", "plan", "push", "refresh"]
}