# 错误：加载状态失败：S3 存储桶 "my-terraform-state" 不存在

- **ID:** `terraform/s3-backend-bucket-not-found`
- **领域:** terraform
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

后端配置中指定的用于状态存储的S3存储桶尚未创建或已被删除。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Terraform v1.5.0 | active | — | — |
| Terraform v1.6.0 | active | — | — |
| Terraform v1.7.0 | active | — | — |

## 解决方案

1. ```
   Create the S3 bucket manually with the correct name and region: `aws s3api create-bucket --bucket my-terraform-state --region us-east-1 --create-bucket-configuration LocationConstraint=us-east-1`
   ```
2. ```
   Update the backend configuration to point to an existing bucket, then run 'terraform init -reconfigure'
   ```

## 无效尝试

- **Run 'terraform init' with -migrate-state flag** — The bucket still doesn't exist; migrate requires an existing bucket. (95% 失败率)
- **Change the bucket name in the backend block to a random new name** — The new bucket also doesn't exist unless created manually. (80% 失败率)
- **Use local backend by removing the backend block** — This changes the state location and may lose remote state history. (70% 失败率)
