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
-
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-example
repo:account
└ _global
└ region
└ _global
└ environment
└ resource
terragrunt.hcl
files are used to tie things together, etc. We have diverged in one way, however. We are typically not using theterraform
andinputs
directives to store local terraform code. Instead, we just drop amain.tf
(or more) alongside theterragrunt.hcl
file and call it a day. Our terragrunt structure usesgenerate
blocks to populate.tf
files in that directory to pass information in (we generateprovider
blocks, etc, but also alocals
block to get access to info from terragrunt).We do realize by putting the terraform code in the
terraform
block we could eliminate that extralocals
file, but with this setup, all but the top-levelterragrunt.hcl
files 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.hcl
file in each deployment directory and have no "raw".tf
files. 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.hcl
file 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
terraform
andinputs
blocks and just dropping that config in a.tf
file? 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.hcl
files and you should always be usingterraform
blocks 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
.tf
files vs embedding things in theterragrunt.hcl
file.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