• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Terraform
  • Install
  • Tutorials
    • About the Docs
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up
Terraform Home

Terraform CLI

Skip to main content
  • Terraform CLI
  • Basic CLI Features
    • Overview
    • import
    • Usage Tips
    • Resource Importability

  • Terraform Internals

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)
  1. Developer
  2. Terraform
  3. Terraform CLI
  4. Importing Infrastructure
  • Terraform
  • v1.2.x
  • v1.1 and earlier

ยปImport

Hands-on: Try the Import Terraform Configuration tutorial.

Terraform can import existing infrastructure resources. This functionality lets you bring existing resources under Terraform management.

Warning: Terraform expects that each remote object is bound to only one resource address. You should import each remote object to only one Terraform resource address. If you import the same object multiple times, Terraform may exhibit unwanted behavior. Refer to State for more details.

State Only

Terraform import can only import resources into the state. Importing does not generate configuration.

Before you run terraform import you must manually write a resource configuration block for the resource. The resource block describes where Terraform should map the imported object.

Terraform Cloud

When you use Terraform on the command line with Terraform Cloud, many commands like apply run inside your Terraform Cloud environment. However, the import command runs locally, so it does not have access to information from Terraform Cloud. To successfully perform an import, you may need to set local variables equivalent to any remote workspace variables in Terraform Cloud.

Edit this page on GitHub

On this page

  1. Import
  2. State Only
  3. Terraform Cloud
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)