terraform
config_error
ai_generated
true
Error: Invalid import ID format: expected <resource_type>.<name> <id>
ID: terraform/invalid-import-id-format
95%Fix Rate
85%Confidence
1Evidence
2024-01-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Terraform v1.8.0 | active | — | — | — |
| Terraform v1.9.0 | active | — | — | — |
| Terraform v1.10.0 | active | — | — | — |
Root Cause
The import command requires a specific two-part argument format (resource address and ID), but the user provided a single string or malformed input.
generic中文
导入命令需要特定的两部分参数格式(资源地址和 ID),但用户提供了单个字符串或格式错误的输入。
Official Documentation
https://developer.hashicorp.com/terraform/cli/commands/importWorkarounds
-
95% success Use the correct two-argument format with a space: `terraform import aws_instance.my_instance i-12345`
Use the correct two-argument format with a space: `terraform import aws_instance.my_instance i-12345`
-
90% success If using shell variables, ensure they expand to separate arguments: `terraform import aws_instance.my_instance "$INSTANCE_ID"`
If using shell variables, ensure they expand to separate arguments: `terraform import aws_instance.my_instance "$INSTANCE_ID"`
中文步骤
Use the correct two-argument format with a space: `terraform import aws_instance.my_instance i-12345`
If using shell variables, ensure they expand to separate arguments: `terraform import aws_instance.my_instance "$INSTANCE_ID"`
Dead Ends
Common approaches that don't work:
-
80% fail
Terraform expects a space separator between the resource address and the ID, not a colon or other delimiter.
-
90% fail
The import command treats the quoted string as a single argument, so it doesn't parse the resource address and ID separately.