Resolving the 'failed to query available provider packages' error when using Terraform
Written by
Updated at November 27, 2023
Issue description
When you attempt to use Terraform for creating, modifying, or deleting cloud resources, you see this error message:
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider yandex-cloud/yandex: could not connect to registry.terraform.io:
│ Failed to request discovery document: 403 Forbidden
Solution
Hashicorp has blocked Russian IP addresses from accessing their repositories.
Use the Hashicorp registry mirror in Yandex Cloud. For this, you need to configure Terraform following this guide:
Then, navigate to the folder with the Terraform manifest code and run terraform init -upgrade
.
If the issue persists
If the above actions didn't help, create a request for support
In the request, specify the following information:
- The content of the
~/.terraformrc
file (on Linux or MacOS computers) or%APPDATA%/terraform.rc
(on Windows computers). - Error output when trying to apply manifest code with the
terraform plan
orterraform apply
command. - The output of the
curl -vk registry.terraform.io
andcurl -vk https://terraform-mirror.yandexcloud.net
command