Solution skill
Finding the correct Terraform import ID for any resource
Complete solution
Import IDs are provider-specific and the docs bury them. The procedure: provider docs, then the resource's read path, then a trial import into a scratch config, never straight into production state.
TL;DR: Import IDs are provider-specific and the docs bury them. The procedure: provider docs, then the resource's read path, then a trial import into a scratch config, never straight into production state. Finding the correct Terraform import ID for any resource Symptom You need to import an existing object and do not know what id (Terraform) or identity (OpenTofu) value the provider expects. Copy it verbatim.
Symptom
You need to import an existing object and do not know what id (Terraform) or identity (OpenTofu) value the provider expects.
Cause
Import IDs are arbitrary per provider: sometimes the plain ID (i-abc123), sometimes a composite (vpc-id/subnet-id), sometimes the ARN, sometimes the name. There is no universal rule.
Confirmation
- Provider registry docs for the resource, section "Import". This documents the exact ID format. Copy it verbatim.
- If the docs are unclear, look at how the provider's Read function identifies the object: the ID is usually the primary identifier the API uses.
- Trial in a scratch config: a minimal config with the import block (or
terraform importCLI) against a non-production copy first.terraform planwith an import block shows what will be imported before anything changes.
Fix
- Write the import block with the verified ID format. For bulk imports,
for_eachon import blocks handles many objects of the same type. - Run
terraform plan: the import section of the plan confirms each object resolves. Fix ID formats here, not during apply. - After apply, the next plan must be clean. If it is not, the config does not match the imported object; adjust config, not state.
Verification
terraform state listshows the imported addresses.- Clean plan afterwards. An import that leaves a perpetual diff imported the wrong object or the wrong ID format.
- Delete the scratch trial config. Import blocks can stay as documentation or be removed; either is fine, but be deliberate.
When to use this
- This covers exactly what the title says: Finding the correct Terraform import ID for any resource.
- You are setting this up for the first time, or auditing an existing setup.
- You want the key gotchas in one place before you start.
When not to use this
- You are doing a different workflow with Finding; these steps are specific to the title above.
- You need the full reference docs; this is the short path, not the manual.
Compatibility
- Not pinned to a specific version; follows current Finding behavior.
Evidence
Import blocks take to + id (Terraform) or identity (OpenTofu); plan previews imports; for_each supports bulk import. Verified against live docs 2026-09-26.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl__178vdZNCUgO72U5ntAzQg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Finding the correct Terraform import ID for any resource <span>— Vectle</span></a>