github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/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 ``` 21 $ terraform import aws_instance.bar i-abcd1234 22 ... 23 ``` 24 25 The above command imports an AWS instance with the given ID to the 26 address `aws_instance.bar`. You can also import resources into modules. 27 See the [resource addressing](/docs/internals/resource-addressing.html) 28 page for more details on the full range of addresses supported. 29 30 The ID given is dependent on the resource type being imported. For example, 31 AWS instances use their direct IDs. However, AWS Route53 zones use the 32 domain name itself. Reference the resource documentation for details on 33 what the ID it expects is. 34 35 As a result of the above command, the resource is put into the state file. 36 If you run `terraform plan`, you should see Terraform plan your resource 37 for destruction. You now have to create a matching configuration so that 38 Terraform doesn't plan a destroy. 39 40 ## Complex Imports 41 42 The above import is considered a "simple import": one resource is imported 43 into the state file. An import may also result in a "complex import" where 44 multiple resources are imported. For example, an AWS security group imports 45 an `aws_security_group` but also one `aws_security_group_rule` for each rule. 46 47 In this case, the name of the resource is shown as part of the import output. 48 You'll have to create a configuration for each resource imported. If you want 49 to rename the other imported resources, the 50 [state management commands](/docs/commands/state/index.html) should be used 51 to rename resources.