# 错误：无法导入不存在的远程对象：导入 ID 格式无效或对象不存在

- **ID:** `terraform/import-id-format-mismatch`
- **领域:** terraform
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

提供给 `terraform import` 的导入 ID 与资源类型的预期格式不匹配，或引用的云资源不存在。

## 版本兼容性

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

## 解决方案

1. ```
   查阅提供程序文档以获取正确的导入 ID 格式。例如，`terraform import aws_instance.my_instance i-1234567890abcdef0`。
   ```
2. ```
   使用 `terraform plan -generate-config-out=generated.tf` 从现有资源自动生成配置，避免手动导入。
   ```

## 无效尝试

- **** — Each resource type has a specific import ID syntax; guessing often results in invalid format. (80% 失败率)
- **** — Some resources require the resource ID (e.g., `i-abc123`) not the ARN; using ARN causes a mismatch. (65% 失败率)
