# 错误：无效的 Terraform 版本约束

- **ID:** `terraform/invalid-terraform-version-constraint`
- **领域:** terraform
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

terraform 块中的 required_version 设置使用了不支持的运算符或格式错误的版本字符串。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Terraform v1.4.0+ | active | — | — |
| OpenTofu 1.6.0 | active | — | — |

## 解决方案

1. ```
   使用有效的约束语法：required_version = ">= 1.4.0, < 2.0.0"
   ```
2. ```
   使用悲观约束运算符：required_version = "~> 1.5"
   ```

## 无效尝试

- **** — Comma is not a valid operator; Terraform expects space-separated constraints like '>= 1.0, < 2.0' is actually invalid, must use '>= 1.0, < 2.0' without comma or use '~>' operator. (60% 失败率)
- **** — The '=' operator is not supported; Terraform interprets bare numbers as pessimistic constraint operator '~>'. (40% 失败率)
