-
-
Notifications
You must be signed in to change notification settings - Fork 998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Provide way to check whether terragrunt is called by terragrunt #2674
Comments
Hello, |
Hi, thanks for the response. 😄 Not sure whether it is really calling terragrunt internally. When the path used in a dependeny block in a configuration (root hcl) contains also a terragrunt.hcl (sibling hcl): how is it handled to get the outputs? Does it read the sibling hcl natively and process it? I am assuming parent and sibling hcl's generate a different state backend configuration. If it does that, I agree. What I mean is: there is no technical include represented using a include block. Just a dependency block. EDIT: Just skipped through the code and found this: terragrunt/config/dependency.go Line 813 in c4a76a1
|
The more I think of it, I think by included you mean the dependency block path attribute. If this would be covered as well it would be quite nice because that would also cover scenarios where optimization takes place (saw some in the code). |
@denis256 Can we support in the further process somehow? Do we need to supply a RFC (design?)? We can also help by implementing. |
I drafted something at #2759 but could not get some parts to work. Sorry for the rough code :D |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue. |
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:
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.get_env
. This solution seems a bit more flexible to me.What do you think?
The text was updated successfully, but these errors were encountered: