| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
tfimport is a Go-based CLI auto-pilot designed to automate the painful process of importing existing infrastructure into a Terraform or OpenTofu state file.
Instead of manually hunting down the correct terraform import string format for every single resource (Is it an ARN? A VPC ID? A namespace/name combo?), you simply write the code that matches your existing infrastructure, generate a plan, and let tfimport figure out the rest.
You can install tfimport from the Arch User Repository using your favorite AUR helper (e.g., yay, paru):
yay -S tfimport-binGrab the latest .deb package from the Releases page and install it:
# Example for amd64 architecture
wget https://github.com/coolapso/tfimport/releases/latest/download/tfimport_<version>_linux_amd64.deb
sudo dpkg -i tfimport_<version>_linux_amd64.debGrab the latest .rpm package from the Releases page and install it:
# Example for amd64 architecture
wget https://github.com/coolapso/tfimport/releases/latest/download/tfimport_<version>_linux_amd64.rpm
sudo rpm -i tfimport_<version>_linux_amd64.rpmIf you have Go installed on your system, you can build and install it directly:
# Install the latest version
go install github.com/coolapso/tfimport@latest
# Or install a specific version
go install github.com/coolapso/tfimport@v0.0.1Download the latest Windows .zip archive from the Releases page. Extract the tfimport.exe binary and move it to a folder that is included in your system's PATH. Alternatively, you can build it from source using the go install method above.
You can also use our convenient installation script that automatically detects your OS and architecture, and downloads the correct binary to /usr/local/bin:
curl -sL https://raw.githubusercontent.com/coolapso/tfimport/main/docs/install.sh | sudo bash(An uninstall script is also available at docs/uninstall.sh)
# Using Terragrunt with an existing plan file
tfimport --tg --plan-file .tfimport/tfplan
# Using Terraform
tfimport --terraform
# Using OpenTofu (Default)
tfimportBy default, tfimport generates a static import.tf file containing HCL import {} blocks (available in Terraform 1.5+ and OpenTofu). You can opt out of this and run CLI imports sequentially by passing the --run-import flag.
tfimport is designed to be highly extensible. The core logic (cmd/root.go) is completely decoupled from the provider-specific logic.
All ID deduction logic lives in the internal/providers/ package. The CLI simply passes the resource type and configuration to providers.GetImportID(ctx, resourceType, config).
Terraform providers (like Azure, GCP, or even AWS) have hundreds to thousands of resources. Each resource has its own specific string format required for the terraform import command.
DO NOT DO THIS MANUALLY. It is incredibly tedious and error-prone.
Instead, we strongly recommend using an AI Agent (like Copilot, Cursor, or Claude) to bootstrap new providers. We have built a specialized workflow for this:
git clone https://github.com/coolapso/tfimport.git
cd tfimport
go build ./...
go run main.go --help| Back | FazBrowse Home | New Git URL |