DEV Community

Spacelift team for Spacelift

Posted on • Edited on • Originally published at spacelift.io

Terraform Import Block in Practice

Adopting Terraform after infrastructure already exists usually starts with the messy part: importing resources into state without accidentally recreating anything. Terraform’s import block (introduced in Terraform v1.5) gives you a declarative way to describe imports in code, so you can version-control the intent and avoid a separate terraform import command for each resource.

In the full guide, we cover:

  • What an import block is and how it works (mapping an external resource ID to a Terraform address)
  • How to import common resource types and validate the outcome before making changes
  • Tips for avoiding surprises: drift, “plan noise,” and partial configuration mismatches
  • How to handle more complex situations (multiple resources, modules, and iterative adoption)

➡️ Read the full article on our blog:

https://spacelift.io/blog/terraform-import-block

Top comments (0)