terragrunt: can't get get_parent_tfvars_dir() to work
Consider the following project:
/terragrunt live folder
├── terraform.tfvars <-- root
├── prd
│ ├── app1
│ | └── terraform.tfvars <-- child
I’d like to access the terraform modules dir located one step above the folder where I have the root terraform.tfvars using get_parent_tfvars_dir() in the child terraform.tfvars as in:
source = "${get_parent_tfvars_dir()}/../modules//app"
but get_parent_tfvars_dir() keeps returning the absolute location of the child terraform.tfvars /path/to/live/prd/app1 instead of returning /path/to/.
Is there anything i’m doing wrong ?
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 3
- Comments: 16 (11 by maintainers)
A neat idea, assuming that all the children of a parent come use the same
modules_source.Note that we will be working on a relatively large refactor of Terragrunt to support the next version of Terraform and HCL2. You can find the rough proposal here: https://github.com/gruntwork-io/terragrunt/issues/466#issuecomment-386258812. That includes a new
get_inputhelper you can use to read variables from other Terragrunt configs, which offers another way to handlesourceURLs where you store the common source in a variable somewhere and reference it everywhere else:I’ve run into same problem attempting to use
get_parent_tfvars_dir()from a “child” config and getting the abs path of the child rather than the parent.