terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

Cache is generating in wrong way

Open headincl0ud opened this issue 2 years ago • 4 comments

I'm using Terragrunt to manage a quite large amount of AWS accounts (>100).

I don't need to categorize these accounts per region/env (every account is independent, managed by different unit), my current directory strategy is looking in this way:

├──cloud-configuration
│   ├── infra
│   ├── terragrunt.hcl
│   │   ├── IT
│   │   │   ├──1234567890
│   │   │   │   ├── ap-northeast-1
│   │   │   │   ├── ap-northeast-2
...
│   │   │   │   ├── ap-south-1
│   │   │   │   │   ├── region.hcl
│   │   │   │   │   └── CONFIG_RULES
│   │   │   │   │       └── REQUIRED_TAGS
│   │   │   │    │   │       └── terragrunt.hcl
│   │   │   │   ├── us-west-1
│   │   │   │   └── us-west-2
│   │   │   │   ├──2345678901
│   │   │   │   ├── ap-northeast-1
│   │   │   │   ├── ap-northeast-2
...
│   │   │   │   ├── ap-south-1
│   │   │   │   │   ├── region.hcl
│   │   │   │   │   └── CONFIG_RULES
│   │   │   │   │       └── REQUIRED_TAGS
│   │   │   │    │   │       └── terragrunt.hcl
│   │   │   │   ├── us-west-1
│   │   │   │   └── us-west-2
├── cloud-modules-aws-config-rules
│   ├── REQUIRED_TAGS

As the administrator, I'm implementing unique account configurations, like AWS Config Rules. Every region has a different configuration (different pack of AWS Config Rules).

Unfortunately, I realized that Terragrunt is generating for every region and for every rule an incredible size of the cache.

Issue:

├──cloud-configuration
│   ├── infra
│   ├── terragrunt.hcl
│   │   ├── IT
│   │   │   ├──1234567890
│   │   │   │   ├── ap-northeast-1
│   │   │   │   ├── ap-northeast-2
...
│   │   │   │   ├── ap-south-1
│   │   │   │   │   ├── region.hcl
│   │   │   │   │   └── CONFIG_RULES
│   │   │   │   │       └── REQUIRED_TAGS
│   │   │   │    │   │       └── terragrunt.hcl
│   │   │   │    │   │       └── .terragrunt-cache
│   │   │   │    │   │   │          └──cloud-configuration
│   │   │   │    │   │   │   │          └──infra 
│   │   │   │    │   │   │   │          └──... 
│   │   │   │   ├── us-west-1
│   │   │   │   └── us-west-2
│   │   │   │   ├──2345678901
│   │   │   │   ├── ap-northeast-1
│   │   │   │   ├── ap-northeast-2
...
│   │   │   │   ├── ap-south-1
│   │   │   │   │   ├── region.hcl
│   │   │   │   │   └── CONFIG_RULES
│   │   │   │   │       └── REQUIRED_TAGS
│   │   │   │    │   │       └── terragrunt.hcl
│   │   │   │    │   │       └── .terragrunt-cache
│   │   │   │    │   │   │          └──cloud-configuration
│   │   │   │    │   │   │   │          └──infra 
│   │   │   │    │   │   │   │          └──... 
│   │   │   │   ├── us-west-1
│   │   │   │   └── us-west-2
├── cloud-modules-aws-config-rules
│   ├── REQUIRED_TAGS

For every account (>100) the cache is generated to every region (16) and for every module (every AWS Config Rule) In the end, the execution took hours to plan all and apply all.

headincl0ud avatar May 04 '22 22:05 headincl0ud

https://github.com/gruntwork-io/terragrunt/issues/1390

headincl0ud avatar May 04 '22 22:05 headincl0ud

Hi, I was wondering if can be used --terragrunt-download-dir <persistent-path> to help keep cached dependencies between runs

denis256 avatar May 09 '22 07:05 denis256

Hi @denis256 ,

The --terragrunt-download-dir is not the solution in this case. The Terragrunt will create the same amount of cache and multiplied directories but in different locations.

headincl0ud avatar May 09 '22 13:05 headincl0ud

@headincl0ud you come up with a solution? we're facing something similar

igkins avatar Jul 12 '22 23:07 igkins

Same issue here. As we add more and more resources, terragrunt seems have to become slower and slower.

gairik-sablono avatar Jan 15 '23 22:01 gairik-sablono

+1 very slow

ashuraits avatar Aug 30 '23 09:08 ashuraits

Extremely slow for me as well, anyone found a solution?

kahootali avatar Nov 30 '23 16:11 kahootali