terraform network_error ai_generated true

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
1Evidence
2023-10-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Terraform v1.5 active
Terraform v1.6 active
Terraform v1.7 active
Terraform v1.8 active

Root Cause

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

generic

中文

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

Official Documentation

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

Workarounds

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

中文步骤

  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.

Dead Ends

Common approaches that don't work:

  1. 90% fail

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

  2. 80% fail

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

  3. 95% fail

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