← Terraform Associate: infrastructure as code
07 / 8 · 20 MIN

Import, inspection, and diagnosis

Adopt existing objects without confusing identity with functional changes.

Concept and mechanism

Import associates an existing object with a resource instance in state. Identify the correct object and prepare compatible configuration; importing does not establish that the next plan will be empty. With import blocks, adoption can participate in plan review. Avoid managing one object through multiple independent addresses. To inspect bindings, prefer supported interfaces such as state list and state show over direct JSON editing. Output may contain sensitive information, so bound collection and sharing.

Guided application

During a network-management migration, separate adoption from redesign. After preparing import, compare the plan with inventory and explain every attribute difference. Unexpected replacement should pause execution until a decision is made. If a provider failure needs detailed logging, use TF_LOG in a bounded reproduction and protect the destination. Retain version, time, execution identity, and relevant error; disable detailed collection afterward. Do not publish raw logs instead of explaining the problem.

IN PRACTICE

An imported subnet is marked for replacement because configuration differs. The team corrects its representation before authorizing any remote change.

Common pitfalls

Assuming import copies all intent; editing state manually; collecting unbounded logs.

Related topics: HCP Terraform and collaboration · IaC and change decisions

Take this idea with you

Controlled adoption starts with identity and ends with an understood plan.

Create account

Reference: Import existing infrastructure · 004