terraform network_error ai_generated true

错误:查询可用提供程序包失败:无法获取 hashicorp/aws 提供程序的可用版本列表:请求在 30 秒后超时

Error: Failed to query available provider packages: could not retrieve the list of available versions for provider hashicorp/aws: request timed out after 30 seconds

ID: terraform/terraform-provider-registry-timeout

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2023-10-01首次发现

版本兼容性

版本状态引入弃用备注
Terraform v1.5 active
Terraform v1.6 active
Terraform v1.7 active
Terraform v1.8 active

根因分析

网络连接问题或注册表服务器超时,导致 Terraform 无法从注册表获取提供程序版本。

English

Network connectivity issue or registry server timeout prevents Terraform from fetching provider versions from the registry.

generic

官方文档

https://developer.hashicorp.com/terraform/cli/config/environment-variables#TF_REGISTRY_CLIENT_TIMEOUT

解决方案

  1. Set the environment variable 'TF_REGISTRY_CLIENT_TIMEOUT' to a higher value, e.g., 60 seconds, and rerun 'terraform init'.
  2. Use a local provider mirror by configuring 'provider_installation' in .terraformrc to use a filesystem mirror or network mirror.

无效尝试

常见但无效的做法:

  1. 90% 失败

    Debug logging does not resolve network timeouts; it only adds verbosity without addressing the root cause.

  2. 80% 失败

    Without a local mirror, Terraform cannot find any providers, leading to a different error about missing providers.

  3. 95% 失败

    Provider blocks do not have a timeout attribute for registry queries; this is a client-side setting.