Skip to content
👷 The Terragrunt website redesign is Work In Progress! 👷
For a list of outstanding TODOs see this.
To give feedback, click here.

Terragrunt Cache

Terragrunt uses a cache directory (.terragrunt-cache) to store downloaded modules when using the source attribute in the terraform block.

This cache directory is created whenever Terragrunt downloads a module from a remote source, and where it runs the OpenTofu/Terraform commands. It also stores any modules and providers that are downloaded as part of these commands by default.

Clearing the Terragrunt cache

Terragrunt creates a .terragrunt-cache folder in the current working directory as its scratch directory. It downloads your remote OpenTofu/Terraform configurations into this folder, runs your OpenTofu/Terraform commands in this folder, and any modules and providers those commands download also get stored in this folder. You can safely delete this folder any time, and Terragrunt will recreate it as necessary.

If you need to clean up a lot of these folders (e.g., after terragrunt run-all apply), you can use the following commands on Mac and Linux:

Recursively find all the .terragrunt-cache folders that are children of the current folder:

Terminal window
find . -type d -name ".terragrunt-cache"

If you are SURE you want to delete all the folders that come up in the previous command, you can recursively delete all of them as follows:

Terminal window
find . -type d -name ".terragrunt-cache" -prune -exec rm -rf {} \;

Also consider setting the TG_DOWNLOAD environment variable if you wish to place the cache directories somewhere else.

If the reason you are clearing out your Terragrunt cache is that you are struggling with running out of disk space, consider using the Provider Cache feature to store OpenTofu/Terraform provider plugins in a shared location, as those are typically the largest files stored in the .terragrunt-cache directory.