A terragrunt best-practice question: pure .hcl is the only way? #574
Unanswered
bstansell23
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So, we've been using terragrunt for a while, find it's features awesome, and use as many bells and whistles as needed to keep our code DRY. We use a deployment structure similar to what's in the
terragrunt-infrastructure-live-examplerepo:account
└ _global
└ region
└ _global
└ environment
└ resource
terragrunt.hclfiles are used to tie things together, etc. We have diverged in one way, however. We are typically not using theterraformandinputsdirectives to store local terraform code. Instead, we just drop amain.tf(or more) alongside theterragrunt.hclfile and call it a day. Our terragrunt structure usesgenerateblocks to populate.tffiles in that directory to pass information in (we generateproviderblocks, etc, but also alocalsblock to get access to info from terragrunt).We do realize by putting the terraform code in the
terraformblock we could eliminate that extralocalsfile, but with this setup, all but the top-levelterragrunt.hclfiles are justand each leaf directory just looks like a basic/usual terraform directory, but with the added hcl file.
All the examples we've seen documented by the terragrunt team show how you can get down to a
terragrunt.hclfile in each deployment directory and have no "raw".tffiles. When we read this, we interpreted this as just one way to keep configs DRY (and when you're just importing a module (terragrunt { source = }}), dropping that simple use into theterragrunt.hclfile makes sense). It certainly makes the examples cleaner.So, to my question: is it "wrong" to do what we're doing, in a terragrunt best-practice sort of way, by skipping the use of the
terraformandinputsblocks and just dropping that config in a.tffile? If our configs are staying DRY, isn't that the real point and best-practice? Or is there an unwritten (as far as we can find) best-practice that terragrunt deployment directories should only contain.hclfiles and you should always be usingterraformblocks to define your deployments?To address another aspect of "best practices", we also have our own module / service structure as discussed in #402. So, this discussion is really about the specific use of local
.tffiles vs embedding things in theterragrunt.hclfile.Have we inadvertently driven off the "best-practices" road here, or are we just over thinking things? Thanks!
Tracked in ticket #109411
Beta Was this translation helpful? Give feedback.
All reactions