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

archive has incorrect │ checksum #2312

Closed
anand1192 opened this issue Oct 13, 2022 · 10 comments
Closed

archive has incorrect │ checksum #2312

anand1192 opened this issue Oct 13, 2022 · 10 comments
Labels
awaiting response Waiting for a response or more data from issue reporter question stale Stale

Comments

@anand1192
Copy link

Error: Failed to install provider

│ Error while installing hashicorp/aws v4.34.0: archive has incorrect
│ checksum
│ zh:c8cc597cba3e94a32f398638189bec49813c27671a2fc50074bd2aab0c8e0f51
│ (expected
│ zh:44e763adae92489f223f65866c1f8b5342e7e85b95daa8d1f483a2afb47f7db3)

@denis256
Copy link
Member

Hi,
seems to be an issue with downloaded modules by Terraform, it is happening each time? or after cache clean it start to work?

https://terragrunt.gruntwork.io/docs/features/caching/#clearing-the-terragrunt-cache

@denis256 denis256 added question awaiting response Waiting for a response or more data from issue reporter labels Oct 16, 2022
@anand1192
Copy link
Author

anand1192 commented Oct 17, 2022

It actually happens every time and I even tried to change the version, clear the current workspace cache, uninstall both terraform and terragrunt, and reinstalled it but nothing helps.

But when I tried "terraform init" with terraform codebase it worked without any issue.

@tjstansell
Copy link
Contributor

This happens for us when you use TF_PLUGIN_CACHE_DIR. Terraform's docs provide this note:

Note: The plugin cache directory is not guaranteed to be concurrency safe. The provider installer's behavior in environments with multiple terraform init calls is undefined.

When you run terragrunt run-all init or let terragrunt auto init, this causes issues when multiple terraform runs try to populate the cache simultaneously. We wrote our own initialization script to optimize/serialize the init process to overcome this. If you don't have that many terraform repos you're trying to initialize, you could use --terragrunt-parallelism=1 to init everything first serially. It's only populating the cache that causes problems. Once it is populated, we've never had issues with lots of parallelism just reading from their cache.

@tjstansell
Copy link
Contributor

See issue #1212 for additional discussion, assuming this is what is hitting you.

@amontalban
Copy link

This happens for us when you use TF_PLUGIN_CACHE_DIR. Terraform's docs provide this note:

Note: The plugin cache directory is not guaranteed to be concurrency safe. The provider installer's behavior in environments with multiple terraform init calls is undefined.

When you run terragrunt run-all init or let terragrunt auto init, this causes issues when multiple terraform runs try to populate the cache simultaneously. We wrote our own initialization script to optimize/serialize the init process to overcome this. If you don't have that many terraform repos you're trying to initialize, you could use --terragrunt-parallelism=1 to init everything first serially. It's only populating the cache that causes problems. Once it is populated, we've never had issues with lots of parallelism just reading from their cache.

@tjstansell can you share the initialization script you mention or a general idea of how you are doing this? We have hundreds of Terragrunt files and using TF_PLUGIN_CACHE_DIR with Atlantis has only generated issues for us.

Thank you in advance!

@tjstansell
Copy link
Contributor

Our script recursively scans for any .tf or .hcl files, then does a best effort parsing of them line-by-line to look for provider definitions. We also pre-install a bunch of our common providers directly into our image as a mirror location.
So, it includes all of those as well to make sure they get pre-cached. Then, in the end, it creates a precache directory with a providers.tf with all of the providers listed and runs terraform init on that one directory. This effectively serializes the provider install. We don't have repos with conflicting provider version requirements or anything like that, so it works for us. But in theory, you could do the same thing in groups if you have multiple versions of a provider that needs to get cached.

@amontalban
Copy link

@tjstansell thank you you gave me some ideas!

@cbugneac-nex
Copy link

I started getting this morning this type of error in GitHub workflow (no cache in TF used) with recently released 5.71:

Initializing provider plugins...
- Finding hashicorp/aws versions matching ">= 5.62.0, >= 5.67.0, >= 5.68.0, >= 5.70.0"...
- Installing hashicorp/aws v5.71.0...
╷
│ Error: Failed to install provider
│
│ Error while installing hashicorp/aws v5.71.0: archive has incorrect
│ checksum
│ zh:e746662547a839b0344729783bb57bdf6899f78d3de19e545d58d0acff9567c4
│ (expected
│ zh:c164d3ed13eb4c28ac243221591fc4ac3cfe621f8cd20af533dedd98a6387363)
╵
Error: Terraform exited with code 1.
Error: Process completed with exit code 1.

but it works fine when ran locally on MacOS laptop:

Initializing provider plugins...
- Finding hashicorp/aws versions matching ">= 5.62.0, >= 5.67.0, >= 5.68.0, >= 5.70.0"...
- Installing hashicorp/aws v5.71.0...
- Installed hashicorp/aws v5.71.0 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

Any idea why checksums doesn't match on Linux OS (GitHub) and works on MacOS ?

@saupolo
Copy link

saupolo commented Oct 11, 2024

I started getting this morning this type of error in GitHub workflow (no cache in TF used) with recently released 5.71

Might be a problem with terraform, a simple terraform init gives me the same error. Reverting to a previous version solves this issue

--edit--

hashicorp/terraform-provider-aws#39676

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue.

@github-actions github-actions bot added the stale Stale label Jan 10, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Waiting for a response or more data from issue reporter question stale Stale
Projects
None yet
Development

No branches or pull requests

6 participants