# 错误：状态快照由 Terraform v1.7 创建，当前版本为 v1.6，版本不兼容

- **ID:** `terraform/state-version-mismatch`
- **领域:** terraform
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

状态文件由较新版本的 Terraform 写入，包含旧版本无法识别的数据结构或功能。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Terraform 1.6.0 | active | — | — |
| Terraform 1.7.0 | active | — | — |
| Terraform 1.7.5 | active | — | — |

## 解决方案

1. ```
   将本地 Terraform 升级到至少 v1.7，从 https://www.terraform.io/downloads 下载或使用 tfenv 版本管理器。然后运行 terraform init。
   ```
2. ```
   如果必须使用 v1.6，从升级前的状态备份中恢复。检查后端是否有自动版本管理（例如 S3 版本控制）。
   ```
3. ```
   使用 Terraform Cloud 或 Terraform Enterprise 的状态管理功能自动处理版本转换。
   ```

## 无效尝试

- **** — The state file itself is the problem, not the backend configuration. Reinit doesn't downgrade state. (95% 失败率)
- **** — State files are complex and interdependent. Manual edits often corrupt the state, causing irreversible damage. (85% 失败率)
- **** — Only the exact version or later that created the state can read it. Jumping to a different version may still fail. (70% 失败率)
