# 查询可用提供程序包失败：无法检索提供程序 hashicorp/aws 的可用版本列表：registry.terraform.io 没有响应

- **ID:** `terraform/invalid-provider-registry-source`
- **领域:** terraform
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

Terraform 无法访问 Terraform Registry (registry.terraform.io) 来获取提供程序元数据，通常是由于网络问题、DNS 故障或代理配置错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Terraform 1.4 | active | — | — |
| Terraform 1.5 | active | — | — |
| Terraform 1.6 | active | — | — |
| Terraform 1.7 | active | — | — |

## 解决方案

1. ```
   Check network connectivity: curl -v https://registry.terraform.io/.well-known/terraform.json
   ```
2. ```
   Use a local provider mirror or filesystem mirror: terraform init -plugin-dir=/path/to/mirror
   ```
3. ```
   Set TF_REGISTRY_DISCOVERY_RETRY=3 to increase retry attempts: export TF_REGISTRY_DISCOVERY_RETRY=3 && terraform init
   ```

## 无效尝试

- **** — Using a non-existent or misconfigured proxy worsens connectivity. (80% 失败率)
- **** — This is an extreme measure that compromises security and may not solve DNS issues. (40% 失败率)
