# 错误：无效索引：输出值为列表但未指定索引

- **ID:** `terraform/invalid-index-in-output`
- **领域:** terraform
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

模块输出返回列表，但在引用时未指定索引，导致 Terraform 期望单个值时类型不匹配。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Terraform >=1.0 | active | — | — |
| AWS Provider 5.x | active | — | — |

## 解决方案

1. ```
   使用显式索引引用输出，例如 `module.my_module.output_name[0]` 或使用 `element(module.my_module.output_name, 0)`。
   ```
2. ```
   如果需要所有值，使用 `module.my_module.output_name[*]` 以保留列表类型。
   ```

## 无效尝试

- **** — Outputs do not support count; this fix leads to a syntax error. (60% 失败率)
- **** — Alters the module's contract and may cause downstream errors. (70% 失败率)
