github.com/kanishk98/terraform@v1.3.0-dev.0.20220917174235-661ca8088a6a/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.
    11  
    12  Terraform can import existing infrastructure resources. This functionality allows you take
    13  resources you created by some other means and bring them 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  ## Terraform Cloud
    42  
    43  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.