terragrunt-infrastructure-live-example
terragrunt-infrastructure-live-example copied to clipboard
How to access global variables from application/service layer
In main terragrunt.hcl file are merged following:
# Configure root level variables that all resources can inherit. This is especially helpful with multi-account configs
# where terraform_remote_state data sources are placed directly into the modules.
inputs = merge(
local.account_vars.locals,
local.region_vars.locals,
local.environment_vars.locals,
)
But in the example they are never accessed, how to access them from subdirs?
I have found another way to do it via imports, but that is traversing the other way trough a tree: https://github.com/gruntwork-io/terragrunt-infrastructure-live-example/issues/70
No, it works via inputs, while in this directory the region and account hcl files defines locals instead of inputs, so it won't work..hm..
Checkout https://terragrunt.gruntwork.io/docs/features/keep-your-terragrunt-architecture-dry/, in particular the section on exposed includes. I believe that is what you are looking for.