-
-
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
RDD: Introduce import blocks to support multiple includes #1803
Conversation
@@ -5,7 +5,7 @@ category: features | |||
categories_url: features | |||
excerpt: Auto-Init is a feature of Terragrunt that makes it so that terragrunt init does not need to be called explicitly before other terragrunt commands. | |||
tags: ["CLI"] | |||
order: 209 | |||
order: 245 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: These are purposely spaced out by 5
so that it is easier to inject additional pages inbetween later.
9c1822e
to
d8c1d51
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks pretty good.
For completeness, I'm going to think out loud and ask a few questions, in part for clarity, in part because it might be worth updating the docs to capture the answers:
-
Should we remove
include
from most of the docs and recommend onlyimport
? Having multiple ways to do something is confusing, so I'd much rather have one, clear, supported, path. We could leaveinclude
in the reference docs and mark it as deprecated, so if you stumble across it in your code, you know what it is, but otherwise, I'd be tempted to remove it from all the quick start guides and the rest. -
I think I asked this way back when we did the
imports
RFC, but am struggling to find the answer, so apologies if this is a repeat. Typically, when I think ofimport
, I think of pulling in a namespace, and then explicitly pulling the things I want out of it. Here, this is more like a multi-include, where callingimport
implicitly changes lots of my configs. Is that intentional? Isimport
the right name then? -
As a sanity check, is it worth trying to come up with a skeleton Ref Arch example that uses
import
to show what the result looks like? I did that for my earlier DRY Ref Arch and you were able to use that to find some important issues. -
NIT: the
read_terragrunt_config
centralizes the versions of the module used in different envs to a single file. Does that break the way we do CI / CD today?
That's a good point and I don't think you asked this on the RFC. I agree with you here and struggled with the naming. Ideally we can use That said, after sleeping on it, I am now thinking if there might be a way to implement the optional label by taking a two-pass parsing approach with different structs. Let me see if that works and report back. If that works, then we solve 1 & 2 by being able to use |
Definitely. My plan was to try out implementing the DRY Ref Arch with the prototype implementation once the direction is finalized from the RDD. I'm actually mostly done with the implementation (just need a few tests to verify functionality), so it's not too far off. |
b636349
to
f788054
Compare
UPDATE: switched back to |
UPDATE: Implemented this version here - #1804 |
Really looking forward to seeing this. From a read of the docs and RFC, the approach here looks good, but seeing it used in a real Ref Arch, even a totally dummy one for testing, makes it way more effective to think about the pros and cons of this design.
Hah, nice, I'll take a look! |
NOTE: I will be closing this as the README has now been ported over to the implementation PR. We can continue any discussions there. |
Ok got the example DRY setups done:
There isn't much difference between the two approaches (the one that you set up using include +
|
That looks really nice! If we update Ref Arch 2.0 to use this, it would be a huge improvement. However, is it worth trying one more experiment first, where the |
This is a README Driven Development PR, and only contains the docs. Note that some of the design decisions are based on an in-progress implementation (see section down below)
This PR is the README updates for the upcoming changes to support including multiple terragrunt configurations in a child. Note that this is different from nested
include
, which is more complicated to implement due to the implications to the relevantinclude
functions likeget_parent_terragrunt_dir
andpath_relative_to_include
.IMPORTANT NOTE
If we wish to maintain backward compatibility with the existing
include
functionality, this implementation requires defining a newimport
block to replaceinclude
. The main reason for this is due to a design choice in the HCL parser where it does not support optional labels on blocks. That is, you can not parse the following two blocks into the same go struct:Once you require a label on the internal struct, the corresponding hcl block MUST have one label - otherwise, the hcl parser errors out saying as such. I found this out in the WIP implementation being done in the branch https://github.com/gruntwork-io/terragrunt/tree/yori-multiple-include-blocks.