github.com/hugorut/terraform@v1.1.3/website/docs/cli/import/index.mdx (about)

     1  ---
     2  page_title: Import
     3  description: >-
     4    Terraform can import and manage existing infrastructure. This can help you
     5    transition your infrastructure to Terraform.
     6  ---
     7  
     8  # Import
     9  
    10  > **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.
    11  
    12  Terraform is able to import existing infrastructure. This allows you take
    13  resources you've created by some other means and bring it under Terraform
    14  management.
    15  
    16  This is a great way to slowly transition infrastructure to Terraform, or
    17  to be able to be confident that you can use Terraform in the future if it
    18  potentially doesn't support every feature you need today.
    19  
    20  ~> Warning: Terraform expects that each remote object it is managing will be
    21  bound to only one resource address, which is normally guaranteed by Terraform
    22  itself having created all objects. If you import existing objects into Terraform,
    23  be careful to import each remote object to only one Terraform resource address.
    24  If you import the same object multiple times, Terraform may exhibit unwanted
    25  behavior. For more information on this assumption, see
    26  [the State section](/language/state).
    27  
    28  ## Currently State Only
    29  
    30  The current implementation of Terraform import can only import resources
    31  into the [state](/language/state). It does not generate configuration. A future
    32  version of Terraform will also generate configuration.
    33  
    34  Because of this, prior to running `terraform import` it is necessary to write
    35  manually a `resource` configuration block for the resource, to which the
    36  imported object will be mapped.
    37  
    38  While this may seem tedious, it still gives Terraform users an avenue for
    39  importing existing resources.
    40  
    41  ## Remote Backends
    42  
    43  When using Terraform import on the command line with a [remote
    44  backend](/language/settings/backends/remote), such as Terraform Cloud, the import
    45  command runs locally, unlike commands such as apply, which run inside your
    46  Terraform Cloud environment. Because of this, the import command will not have
    47  access to information from the remote backend, such as workspace variables.
    48  
    49  In order to use Terraform import with a remote state backend, you may need to
    50  set local variables equivalent to the remote workspace variables.