2016-05-18 20:47:41 +02:00
---
2021-12-15 03:41:17 +01:00
page_title: Import
description: >-
Terraform can import and manage existing infrastructure. This can help you
transition your infrastructure to Terraform.
2016-05-18 20:47:41 +02:00
---
# Import
2020-10-02 20:02:59 +02:00
> **Hands-on:** Try the [Import Terraform Configuration](https://learn.hashicorp.com/tutorials/terraform/state-import?in=terraform/state&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
2020-07-31 22:16:35 +02:00
2016-05-18 20:47:41 +02:00
Terraform is able to import existing infrastructure. This allows you take
resources you've created by some other means and bring it under Terraform
management.
This is a great way to slowly transition infrastructure to Terraform, or
to be able to be confident that you can use Terraform in the future if it
potentially doesn't support every feature you need today.
2020-08-01 00:22:50 +02:00
~> Warning: Terraform expects that each remote object it is managing will be
bound to only one resource address, which is normally guaranteed by Terraform
itself having created all objects. If you import existing objects into Terraform,
be careful to import each remote object to only one Terraform resource address.
If you import the same object multiple times, Terraform may exhibit unwanted
behavior. For more information on this assumption, see
2021-12-15 03:41:17 +01:00
[the State section](/language/state).
2020-08-01 00:22:50 +02:00
2016-05-18 20:47:41 +02:00
## Currently State Only
The current implementation of Terraform import can only import resources
2021-12-15 03:41:17 +01:00
into the [state](/language/state). It does not generate configuration. A future
2016-05-18 20:47:41 +02:00
version of Terraform will also generate configuration.
2017-05-17 03:26:20 +02:00
Because of this, prior to running `terraform import` it is necessary to write
manually a `resource` configuration block for the resource, to which the
2019-03-23 00:10:44 +01:00
imported object will be mapped.
2016-05-18 20:47:41 +02:00
While this may seem tedious, it still gives Terraform users an avenue for
2020-05-21 02:44:43 +02:00
importing existing resources.
2020-06-29 17:38:46 +02:00
2021-12-21 23:51:06 +01:00
## Terraform Cloud
2020-09-29 01:03:15 +02:00
2022-01-26 17:41:57 +01:00
When you use Terraform on the command line with Terraform Cloud, many commands (e.g., `apply`) run inside your Terraform Cloud environment. However, the `import` command runs locally, so it will 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.