Automatic Provider Cache Dir works as such, but downloads too much #5228
Replies: 4 comments
-
|
I cannot use this feature. I have right now a whole forest of I think Automatic Provider Cache Dir right now is only acceptable with very small Terragrunt repos. I'm going back to Provider Cache Server. |
Beta Was this translation helpful? Give feedback.
-
|
Wow, I went back to Provider Cache Server, and it's orders of magnitude faster, while working in a much bigger environment. Automatic Provider Cache Dir is not usable in the real world. I would be sitting here all day if I tried to enable it in any environment that's not tiny. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @FlorinAndrei , Thanks for sharing that! This seems better served as a community discussion rather than a bug report, so I've converted it to one. Hope you don't mind. We've left the Provider Cache Server available in Terragrunt because of the scaling issues that you've mentioned. It's very dependent on user setups (the number and kinds of providers they use, the number of units they manage and whether or not If you can construct simple reproducible examples where OpenTofu can be more efficient in its provider caching, we're open with sharing those findings with the OpenTofu team to see if we can get OpenTofu provider caching speeds improved. There are already optimizations planned, and you can expect it to be faster in the near future. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, there's information I did not provide initially: We freeze the versions of all infrastructure tools we use: Terragrunt, OpenTofu, the major providers such as AWS. This prevents variability that has bothered us in the past. This also means upgrades are deliberate, and happen across large chunks of infrastructure (whole environments). In generate "versions_override" {
path = "versions_override.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "${local.aws_provider_version}"
}
# other providers
}
}
EOF
}We do not track lock files in repos. Today, I've updated Terragrunt and OpenTofu to the latest versions. That went well. Then I changed the versions for the AWS provider and another provider, and switched from Provider Cache Server to Automatic Provider Cache Dir. That's when things blew up in my face. A recursive Terragrunt I think they downloaded the providers many hundreds of times. I stopped testing, and went back to Provider Cache Server. It was faster by orders of magnitude. I've completed the migration with Provider Cache Server enabled, and I will keep it enabled for the time being. I have CICD runners that may need to run Terragrunt. They do not have caching enabled, so they would have to download the providers - and would likely run into the same problem with Automatic Provider Cache Dir. But with Provider Cache Server they work well. Gruntwork has a document where the two caches are compared. I think that document should make it very clear you should not use the new cache if you're operating at scale and you do not allow provider versions to fluctuate freely. Regardless, CICD runners with no caching, or even just Something needs to change in the new cache to prevent every single For all these reasons, I think the old cache is a better idea overall. The cache folder is shared, and the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
With Terragrunt v0.95.0 and OpenTofu 1.11.1, I've disabled the Provider Cache Server. Instead, I've allowed Terragrunt to use the Automatic Provider Cache Dir.
It looks like the Automatic Provider Cache Dir works as a cache, it symlinks files to the cache folder. However, if I run
terragrunt run --all -- init -upgradein a folder with lots of resources, this takes a very long time to complete.The reason is that each
tofuprocess actually downloads the provider files. I don't think they get overwritten in the cache, but everytofuprocess spawned begins to download provider files.This is slow and wasteful of bandwidth.
Provider Cache Server did not have this issue.
Steps To Reproduce
Use a repo with lots of resources already created.
Upgrade the AWS provider version.
Run
terragrunt run --all -- init -upgradeat the top of the repo.Expected behavior
The cache mechanism should only download the provider once, save it, and re-use it. Provider Cache Server works like this.
Must haves
Nice to haves
Versions
Beta Was this translation helpful? Give feedback.
All reactions