github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/import/usage.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Import: Usage"
     4  sidebar_current: "docs-import-usage"
     5  description: |-
     6    The `terraform import` command is used to import existing infrastructure.
     7  ---
     8  
     9  # Import Usage
    10  
    11  The `terraform import` command is used to import existing infrastructure.
    12  
    13  The command currently can only import one resource at a time. This means
    14  you can't yet point Terraform import to an entire collection of resources
    15  such as an AWS VPC and import all of it. A future version of Terraform will
    16  be able to do this.
    17  
    18  Using `terraform import` is simple. An example is shown below:
    19  
    20  ```shell
    21  $ terraform import aws_instance.bar i-abcd1234
    22  ```
    23  
    24  The above command imports an AWS instance with the given ID to the
    25  address `aws_instance.bar`. You can also import resources into modules.
    26  See the [resource addressing](/docs/internals/resource-addressing.html)
    27  page for more details on the full range of addresses supported.
    28  
    29  The ID given is dependent on the resource type being imported. For example,
    30  AWS instances use their direct IDs. However, AWS Route53 zones use the
    31  domain name itself. Reference the resource documentation for details on
    32  what the ID it expects is.
    33  
    34  As a result of the above command, the resource is put into the state file.
    35  If you run `terraform plan`, you should see Terraform plan your resource
    36  for destruction. You now have to create a matching configuration so that
    37  Terraform doesn't plan a destroy.
    38  
    39  ## Complex Imports
    40  
    41  The above import is considered a "simple import": one resource is imported
    42  into the state file. An import may also result in a "complex import" where
    43  multiple resources are imported. For example, an AWS security group imports
    44  an `aws_security_group` but also one `aws_security_group_rule` for each rule.
    45  
    46  In this case, the name of the resource is shown as part of the import output.
    47  You'll have to create a configuration for each resource imported. If you want
    48  to rename or otherwise modify the imported resources, the
    49  [state management commands](/docs/commands/state/index.html) should be used.