gruntwork-io/terragrunt-infrastructure-live-example

[QUESTION] Including a _global folder

nilsdebruin opened this issue · 4 comments

I am using this repository as an example to create my infrastructure and I am really appreciating it!
In the documentation, it is mentioned that you could include a _global folder within the account folder perspective:

account
_global
us-east-1

When I run terragrunt plan from within the _global folder based on this set-up, terragrunt mentions ParentFileNotFound, could not find a region.hcl in any of the parent folders.

This makes sense, as the root terragrunt.hcl tries to open region.hcl and its entries.

To keep the main code intact, I have now created an extra folder, with the region as us-east-1, as a workaround, like this:

account
_global
region.hcl
_global

This works, but it doesn't seem like a clean way. What do you think is the right approach to mitigate this?

We typically have a region.hcl in each region folder (e.g., us-east-1/region.hcl) and one in each _global folder (e.g., _global/region.hcl). Typically, you need an AWS region to send API requests to, even for resources that don't live in a specific region, so we just pick some reasonable default for the _global region.

Hi, @brikis98 thanks for the reply! I will follow this route, many thanks for the fast reply!

Yes this issue is closed, but please can someone help with a use case example of using the _global feature in terragrunt. Its not reflected in the "terragrunt-infrastructure-live-example", would highly appreciate

_global isn't really a feature, but an organizational construct that you may or may not want to use. The main use case for it is for managing resources that don't have an explicit region associated with it, like IAM roles. Here is an example from our landingzone guide: https://gruntwork.io/guides/foundations/how-to-configure-production-grade-aws-account-structure/#apply-the-security-baseline-to-the-root-account