Documentation query - commands on multiple modules

in section Execute Terraform commands on multiple modules at once

Let’s say your infrastructure is defined across multiple Terraform modules:

a
in section The apply-all, destroy-all, output-all and plan-all commands the documentation states that

To be able to deploy multiple Terraform modules in a single command, add a terragrunt.hcl file to each module:
b

my question is

shouldn’t the main.tf files be in a separate directory structure/git repo?

Hi,

You’re right that the .tf files should preferably be placed in a separate repo (infrastructure-modules) and referenced in your infrastructure-live terragrunt.hcl files. Best starting point to read about the recommended repo/directory layout is this article: https://blog.gruntwork.io/terragrunt-how-to-keep-your-terraform-code-dry-and-maintainable-f61ae06959d8

You can check the example repositories for reference:


Also, the terragrunt README contains loads of useful links and information about best practices setup.