-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Implement imports RFC #1566
Comments
I see that this ticket has been marked as high priority and there are only 10 of those in total at the time of this comment so I believe it is one of the next few in the queue but do you have a general timeframe for this being implemented by chance @yorinasub17 ? |
|
First feature in the list is now implemented in https://github.com/gruntwork-io/terragrunt/releases/tag/v0.30.4 |
Deep merge with cross include dependency reference support is now available: https://github.com/gruntwork-io/terragrunt/releases/tag/v0.31.3 |
Multiple This feature should allow significantly more DRY |
@yorinasub17 what is the current status on adding the ability to include multiple levels? THX |
@chrisurf It needs some more design cycles to think through what it would mean to the functions. That said, with multiple |
@yorinasub17 Any news on nested includes? |
i tend to agree with the above comment. single include level prevents breaking the parent into re-useable include blocks. including those blocks at a child level makes no sense since it would break DRY. any chance we can get this moving? |
Indeed, due to this limitation it does not seem to be possible to include anything in a root config at all, which is a problem. In fact, if we do include "root" {
path = find_in_parent_folders()
} as recommended in https://terragrunt.gruntwork.io/docs/features/keep-your-terragrunt-architecture-dry/, then there cannot be an include in any of the parent folder configurations anymore. |
Is this still being worked on? |
+1 |
@GergelyKalmar I recommend naming your root "root.hcl" (or anything else) and then doing include "root" {
path = find_in_parent_folders("root.hcl")
} the default parameter of the find_in_parent_folders function is "terragrunt.hcl" but the name of included files is arbitrary |
I'm not sure if that helps, from what I understand the limitation is that only a single level of includes is allowed. It does not matter what the root config is called, you will still get an error if there is any other include anywhere else. |
Hi. Any updates on this development? Is it still being pursued? Thanks |
Would be great if nested includes were implemented. Currently we have laid out an environment/component strategy where we need to repeat the generic component configuration in every component: include "root" {
path = find_in_parent_folders()
}
# Include the common configuration for the component. The common configuration contains settings that are common
# for the component across all environments.
include "common" {
path = "${dirname(find_in_parent_folders())}/infrastructure/${basename(get_terragrunt_dir())}/terragrunt.hcl"
expose = true
} This Tree:
Full example in git: |
Any update on this? Brain hurts trying to workaround this limitation. Does anybody have a less ugly solution? |
Here is approach I use for merging cfg.yaml files in nested directories of terragrunt stacks: https://github.com/amkartashov/terragrunt-nested-configuration In short, all this is not actual code, this is effectively generated code cfg = merge([
try(yamldecode(file("TOP_DIR/cfg.yaml")), {}),
try(yamldecode(file("TOP_DIR/prod/cfg.yaml")), {}),
try(yamldecode(file("TOP_DIR/prod/ecs/cfg.yaml")), {}),
try(yamldecode(file("TOP_DIR/prod/ecs/cluster/cfg.yaml")), {}),
]...) |
another idea is to use terramate to generate nested configuration https://github.com/amkartashov/terramate-terragrunt-example this approach is more flexible, because terramate is responsible for merging configuration files, not |
@yorinasub17 what is the current status on adding the ability to include multiple levels? |
@elopsod https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#read_terragrunt_config this might be a viable workaround. |
Hey folks, I've been asked to look at this, and I think there's a good argument to be made to close this out as won't do: If folks agree, I'll cut a PR to mark the RFC as won't do in the docs site. |
https://terragrunt.gruntwork.io/docs/rfc/imports/
NOTE: In the RFC, we mention implementing
import
as a separate block. To expedite development, we recommend implementing it as part ofinclude
by enhancing its capability in backwards compatible ways.Recommended phased implementation (expectation is that each of bullets is a separate PR):
[IMPLEMENTED] Expose the underlying config values under a reference var. E.g., being able to say
include.foo.locals
.read_terragrunt_config
, and has the advantage of providing a way to solve read_terragrunt_config with dependency is broken #1128 because we have more control over when parsing happens during a block decode, than a function eval.[(a) IMPLEMENTED ; (b) IMPLEMENTED] Add the ability to configure the way included config merges. Right now
include
does an automatic shallow merge. In addition to shallow merge, user should have the ability to specify (a) no merge (full replacement forread_terragrunt_config
), and (b) deep merge.[IMPLEMENTED]Add ability to configure the included config to automatically fetch and expose dependencies.
[IMPLEMENTED]Add the ability to have multiple include blocks in one child config.
Add the ability to include multiple levels. Note that a potential yak shave is that this may break the include related functions, like
get_parent_terragrunt_folder
andpath_relative_to_include
. We will need to respecify how these work when multiple levels are included.The text was updated successfully, but these errors were encountered: