Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terragrunt caching info from GIT #658

Closed
bab5470 opened this issue Feb 15, 2019 · 1 comment
Closed

Terragrunt caching info from GIT #658

bab5470 opened this issue Feb 15, 2019 · 1 comment

Comments

@bab5470
Copy link

@bab5470 bab5470 commented Feb 15, 2019

Terragrunt seems to be caching my terraform scripts from GIT. Consequently each time I need to re-run terragrunt apply after changing my terraform scripts I need to first do rm -r -f .terragrunt-cache/ certainly that's not by design? How do I tell terragrunt to stop using the local cache?

@bab5470
Copy link
Author

@bab5470 bab5470 commented Feb 15, 2019

I'll answer my own question since I stumbled upon the answer:

Important gotcha: Terragrunt caching
The first time you set the source parameter to a remote URL, Terragrunt will download the code from that URL into a tmp folder. It will NOT download it again afterwords unless you change that URL. That’s because downloading code—and more importantly, reinitializing remote state, redownloading provider plugins, and redownloading modules—can take a long time. To avoid adding 10-90 seconds of overhead to every Terragrunt command, Terragrunt assumes all remote URLs are immutable, and only downloads them once.

Therefore, when working locally, you should use the --terragrunt-source parameter and point it at a local file path as described in the previous section. Terragrunt will copy the local files every time you run it, which is nearly instantaneous, and doesn’t require reinitializing everything, so you’ll be able to iterate quickly.

If you need to force Terragrunt to redownload something from a remote URL, run Terragrunt with the --terragrunt-source-update flag and it’ll delete the tmp folder, download the files from scratch, and reinitialize everything. This can take a while, so avoid it and use --terragrunt-source when you can!

@bab5470 bab5470 closed this as completed Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant