Centralize resources configuration

Hi,

I have an environment in AWS that build like this:

infrastructure-live

├── prod
│ ├── app
│ │ └── terragrunt.hcl
│ ├── mysql
│ │ └── terragrunt.hcl
│ └── vpc
│ └── terragrunt.hcl
├── qa
│ ├── app
│ │ └── terragrunt.hcl
│ ├── mysql
│ │ └── terragrunt.hcl
│ └── vpc
│ └── terragrunt.hcl
└── stage
├── app
│ └── terragrunt.hcl
├── mysql
│ └── terragrunt.hcl
└── vpc
└── terragrunt.hcl

I want to create a central place that all the resources will be managed easily. So in every environment the terragrunt.hcl will call to all terragrunt.hcl for all the resources.

for example, it will be changed to that:

infrastructure-live

├── shard_resources
│ ├── app
│ │ └── terragrunt.hcl
│ ├── mysql
│ │ └── terragrunt.hcl
│ └── vpc
│ └── terragrunt.hcl
├── prod
│ ├── terragrunt.hcl
├── qa
│ ├── terragrunt.hcl
└── stage
├── terragrunt.hcl

Does someone have an idea if that can be possible?

Hi,

This is unfortunately not something that Terragrunt currently supports. You could DRY up the individual configurations using multiple includes, but you still will need the individual terragrunt.hcl files in the environment folders. The closest thing to this would be RFC: single terragrunt.hcl per environment? · Issue #759 · gruntwork-io/terragrunt · GitHub, however I believe even that is not really exactly what you are looking for.

Implementing something like this requires a new paradigm in Terragrunt and we are unlikely to implement this anytime soon due to backward compatibility concerns. I’m sorry we don’t have a better answer than that here…

Best regards,
Yori

Hi @yoriy,

Thank you for your answer. I will be happy to know if you or someone else have an idea how can I transfer the code between regions without copying the code every time?

Liran