tfimport logo tfimport
tfimport Gopher Mascot

The Auto-Pilot for Infrastructure Imports

Automate the painful process of importing existing infrastructure into a Terraform or OpenTofu state file without hunting down provider-specific string formats.

Why use tfimport?

🚀

Multi-Tool Support

Works seamlessly out of the box with terraform, terragrunt, and tofu.

🧠

Smart ID Deduction

Understands the provider-specific import formats for hundreds of resources across AWS, Google, Azure, Kubernetes, and more.

🔌

SDK Lookups

Uses cloud provider SDKs to dynamically look up opaque IDs (like vpc-xxxxx) based on tags and attributes known at plan time.

How it works

terminal

# 1. Write your manifests to match the infrastructure that already exists

cat main.tf

# 2. Run tfimport to generate an import.tf file

tfimport

✔ Executing plan (tofu)...

✔ Parsing tfplan...

✔ Computing import IDs...

✔ Import file generated at /home/user/project/import.tf

You can now run `tofu apply` to import the resources

# Alternatively, run import directly via CLI

tfimport --run-import

✓ These resources will be imported:

Address: aws_s3_bucket.main, ImportID: my-app-bucket

Want to proceed with import? [y/N]: y

✔ Successfully imported aws_s3_bucket.main

Installation

macOS / Linux (Install Script)

Automatically detects OS/arch and installs to /usr/local/bin.

curl -sL https://raw.githubusercontent.com/coolapso/tfimport/main/docs/install.sh | sudo bash