Description
Describe the solution you'd like
I'd like to have a function or variable enabling me to distinguish whether the current terragrunt execution was initiated by another terragrunt run. This is e.g. the scenario when you reference another directory containing a terragrunt.hcl in a dependency block. A way to handle those scenarios would be beneficial when e.g. another state would need be addressed when fetching outputs using the dependency block.
Describe alternatives you've considered
We distinguish states partly by using environment variables where we would have 60+ directories (each environment) for 30+ teams. This does work quite well except when a dependency block is used and a state file should be referenced which is not addressable using the environment variables.
We evaluated mirroring the state address components in the directory structure, but yielded this will become unmaintainable with growing number of teams and environments. Where also environments come and go which would mean deleting directories across 30+ teams.
Additional context
I see two possible ways to address this:
- Have a function e.g.
is_silent_run_by_terragrunt
which enables me to detect this scenario. Optionally this may be extended to also contain the operation e.g.output
to further distinguish. Of course scenarios like run-all make this a bit hard to define when this function will return what value as run-all also runs terragrunt in a subdirectory. - Being able to attach environment variables in the dependency block which can be read in the other terragrunt configuration using
get_env
. This solution seems a bit more flexible to me.
What do you think?
Metadata
Metadata
Assignees
Type
Projects
Status