Pass child local to parent local?
The subject is the best way to describe what I am trying to do. I am trying to merge a local that appears down in the filesystem into a local that is in `_common/common.hcl`. The error that I am getting is: ``` aws_account_alias [REASON: Can't evaluate expression at (filesystem_path)/_common/common.hcl:4,22-66 because local reference 'environment' is not evaluated. ``` This is how I have things setup. `_common/common.hcl` ```hcl locals { aws_account_alias= "networking-${local.environment}-01" } ``` `environments/account-dev/account.hcl` ```hcl locals { account_id = "12345678901" environment = "dev" } ``` `environments/networking-dev/us-east-1/terragrunt.hcl` ```hcl locals { aws_region = "us-east-1" } include "root" { path = find_in_parent_folders() } ``` `terragrunt.hcl` This is the relevant part of `terragrunt.hcl`: ```hcl locals { account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) common_vars = read_terragrunt_config(find_in_parent_folders("_common/common.hcl")) } ``` Are locals evaluated in the order they are included? Thanks for any help you can provide. --- <ins datetime="2023-06-08T19:41:19Z"> <p><a href="https://support.gruntwork.io/hc/requests/110244">Tracked in ticket #110244</a></p> </ins>
Hello, configuration can be extracted to separated HCL file and loaded in parent file through `read_terragrunt_config()` using functions to get paths `get_terragrunt_dir()` or `path_relative_to_include()` I also prepared simplified example in https://github.com/denis256/terragrunt-tests/tree/master/discussion-734 References: https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#read_terragrunt_config https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#get_terragrunt_dir https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#path_relative_to_include