nameoptional(string)
The label of the include block whose directory to return. A unit with more than one include block needs it. In the included file, it has no effect.
get_parent_terragrunt_dir([name: string]) --> stringA file that many units include can use get_parent_terragrunt_dir to point every unit at a file next to it, however deep the unit is:
terraform { extra_arguments "common_vars" { commands = ["plan", "apply"] arguments = [ "-var-file=${get_parent_terragrunt_dir()}/common.tfvars", ] }}Without an include block, it returns the unit’s directory, like get_terragrunt_dir.
A unit with more than one include block passes the label of the one to use:
include "root" { path = find_in_parent_folders("root.hcl")}
include "region" { path = find_in_parent_folders("region.hcl")}
terraform { source = "${get_parent_terragrunt_dir("root")}/modules//mysql"}The label of the include block whose directory to return. A unit with more than one include block needs it. In the included file, it has no effect.
When /home/me/infra/prod/mysql/terragrunt.hcl includes this file.
locals { root_dir = get_parent_terragrunt_dir() # "/home/me/infra"}