Loading...
Loading...
### Terraform Version ```shell $ terraform version Terraform v1.8.5 on linux_amd64 ``` ### Terraform Configuration Files ```terraform terraform { required_providers { local = { source = "hashicorp/local" version = "2.5.2" } } } resource "local_file" "example" { content = "https://github.com/hashicorp/terraform-provider-local/issues/408" filename = "${path.module}/terraform-robust-version-query.txt" file_permission = "0644" } ``` ### Debug Output ``` ... ``` ### Expected Behavior `terraform init` must not fail, if there is an invalid version published to terraform provider registry for any of the configured providers. Instead of failing, it should ignore the error and continue with parsing other available versions ### Actual Behavior ~An incident~ Multiple incidents occurred today after an invalid version of the `hashicorp/local` was published to the TF providers registry, causing `terraform init` was failing for anyone who had the provider configured in their TF code https://github.com/hashicorp/terraform-provider-local/issues/408 : ``` │ Error: Failed to query available provider packages │ │ Could not retrieve the list of available versions for provider │ hashicorp/local: could not query provider registry for │ registry.terraform.io/hashicorp/local: registry response includes invalid │ version string "v2.5.3-alpha1": a "v" prefix should not be used ``` ### Steps to Reproduce 1. publish an invalid version of a TF provider to the TF registry with its version containing `v` prefix, e.g. `"version":"v2.5.3-alpha1"`. The registry https://registry.terraform.io/v1/providers/hashicorp/local/versions will serve the following JSON: ```json {"id":"hashicorp/local","versions":[{"version":"v2.5.3-alpha1","protocols":["5.0"],"platforms":[{"os":"darwin","arch":"amd64"},{"os":"darwin","arch":"arm64"},{"os":"freebsd","arch":"386"},{"os":"freebsd","arch":"amd64"},{"os":"freebsd","arch":"arm"},{"os":"linux","arch":"386"},{"os":"linux","arch":"amd64"},{"os":"linux","arch":"arm"},{"os":"linux","arch":"arm64"},{"os":"windows","arch":"386"},{"os":"windows","arch":"amd64"}]},{"version":"2.4.1","protocols":["5.0"],"platforms":[{"os":"freebsd","arch":"arm"},{"os":"freebsd","arch":"amd64"},{"os":"linux","arch":"amd64"},{"os":"linux","arch":"arm"},{"os":"freebsd","arch":"386"},{"os":"darwin","arch":"arm64"},{"os":"windows","arch":"386"},{"os":"linux","arch":"386"},{"os":"linux","arch":"arm64"},{"os":"darwin","arch":"amd64"},{"os":"windows","arch":"amd64"}]}],"warnings":null} ``` 2. `terraform init` fails with `Error: Failed to query available provider packages` ### Additional Context https://github.com/hashicorp/terraform-provider-local/issues/408 https://github.com/hashicorp/terraform-provider-local/issues/410 ### References - https://github.com/hashicorp/terraform-provider-local/issues/408 - https://github.com/hashicorp/terraform-provider-local/issues/410 ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.