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

terraform providers lock should use the plugin cache #33837

Closed
markusheiden opened this issue Sep 7, 2023 · 5 comments · Fixed by #34632
Closed

terraform providers lock should use the plugin cache #33837

markusheiden opened this issue Sep 7, 2023 · 5 comments · Fixed by #34632
Labels
enhancement new new issue not yet triaged

Comments

@markusheiden
Copy link

markusheiden commented Sep 7, 2023

Terraform Version

Terraform v1.5.6

Use Cases

Provider maintenance: Regular updates.

We have many workspaces and we use multiple architectures:

  • macOS amd64 and arm64 for local development.
  • Windows amd64 for local development.
  • Linux amd64 for the CI.

Updating the .terraform.lock.hcl of a workspace via terraform providers lock -platform=darwin_arm64 -platform=darwin_amd64 -platform=linux_amd64 -platform=windows_amd64 takes very long.
For all of the workspaces, the hashes (even of the not modified providers) are retrieved over and over from the registry.
So this "penalty" even multiplies.

Recently, the repeated downloads even fail: E.g.

Error: Could not retrieve providers for locking
Terraform failed to fetch the requested providers for darwin_arm64 in order to calculate their checksums: some providers could not be installed:
- registry.terraform.io/gitlabhq/gitlab: github.com: Get "https://github.com/gitlabhq/terraform-provider-gitlab/releases/download/v16.3.0/terraform-provider-gitlab_16.3.0_darwin_arm64.zip": dial tcp 140.82.121.3:443: i/o timeout.

Downloading the file with the browser is no problem.

Attempted Solutions

I configured the plugin cache. But it is not used by terraform providers lock.

Proposal

Let terraform providers lock use the plugin cache (read & write). That includes caching plugins of all architectures.

References

@markusheiden markusheiden added enhancement new new issue not yet triaged labels Sep 7, 2023
@crw
Copy link
Contributor

crw commented Sep 11, 2023

Thanks for this feature request!

If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!

@jsyrjala
Copy link

Yesterday running terraform providers lock -platform=darwin_amd64 -platform=darwin_arm64 -platform=linux_amd64 -platform=windows_amd64 on one terraform stack took 56 minutes, because dowloading aws provider from https://releases.hashicorp.com/ was so slow. I have several stacks, which each have mostly identical plugins and plugin versions.

So for each of terraform providers lock commands is downloading exact same files and takes from 20 minutes 50 minutes per command to do that.

@jsyrjala
Copy link

Related #27811

@davidgwps
Copy link

davidgwps commented Dec 14, 2023

I would love this improvement, we also take a long to regenerate the lock files using the same command as @jsyrjala. I would like to run the provider locks command in CI so I can ensure locks are up to date and latest are checked in with pull requests as we occassionally get CI failures when people have forgotten. It's too slow to run across the folder structure every time.

DanielMSchmidt added a commit that referenced this issue Feb 7, 2024
this is only possible for the architecture of the system since the cache is only for one architecture.

Closes #33837
DanielMSchmidt added a commit that referenced this issue Feb 8, 2024
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement new new issue not yet triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants