mirror of
https://github.com/hashicorp/terraform.git
synced 2026-04-28 17:48:59 -04:00
* website: plannable import docs * website: config gen docs * Update website/docs/cli/commands/plan.mdx Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * Update website/docs/cli/import/index.mdx Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * Update website/docs/language/import/index.mdx Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * Update website/docs/language/import/index.mdx Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * fix docs rendering * Apply suggestions from code review Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * link again to import blocks * fix genconfig example plan output * Update website/docs/language/import/index.mdx Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * add import resource config example * Apply suggestions from code review Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * attempt to fix nav * more explicit * fix build? * remove pseudo tutorial * add advice on when to gen * add note on idempotency * Apply suggestions from code review Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> Co-authored-by: Alan Szlosek Jr <alan.szlosek@hashicorp.com> * refer to cli cmd in usual way * more explanation for genconfig * remove unnecessary sentence * add heading * update help text * Apply suggestions from code review Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * update link * add import ID section * Apply suggestions from code review Co-authored-by: rita <8647768+ritsok@users.noreply.github.com> Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: rita <8647768+ritsok@users.noreply.github.com> Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * dial back didacticism * clarify genconfig instructions * explicit explanation of arg conflict * Apply suggestions from code review Co-authored-by: rita <8647768+ritsok@users.noreply.github.com> Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> * clarify import block required for genconfig --------- Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com> Co-authored-by: Alan Szlosek Jr <alan.szlosek@hashicorp.com> Co-authored-by: rita <8647768+ritsok@users.noreply.github.com>
26 lines
2 KiB
Text
26 lines
2 KiB
Text
---
|
|
page_title: Import
|
|
description: >-
|
|
Terraform can import and manage existing infrastructure. This can help you
|
|
transition your infrastructure to Terraform.
|
|
---
|
|
|
|
# Import
|
|
|
|
> **Hands-on:** Try the [Import Terraform Configuration](/terraform/tutorials/state/state-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
|
|
|
|
Terraform can import existing infrastructure resources. This functionality lets you bring existing resources under Terraform management.
|
|
|
|
-> **Note:** Terraform v1.5.0 and later supports `import` blocks. Unlike the `terraform import` command, you can use `import` blocks to import more than one resource at a time, and you can review imports as part of your normal plan and apply workflow. [Learn more about `import` blocks](/terraform/language/import).
|
|
|
|
## State Only
|
|
|
|
~> **Warning:** Terraform expects that each remote object is bound to a _single_ resource address. You should import each remote object to _one_ Terraform resource address. If you import the same object multiple times, Terraform may exhibit unwanted behavior. See [State](/terraform/language/state) for more details.
|
|
|
|
The `terraform import` CLI command can only import resources into the [state](/terraform/language/state). Importing via the CLI does _not_ generate configuration. If you want to generate the accompanying configuration for imported resources, [use the `import` block instead](/terraform/language/import).
|
|
|
|
Before you run `terraform import` you must manually write a `resource` configuration block for the resource. The resource block describes where Terraform should map the imported object.
|
|
|
|
## Terraform Cloud
|
|
|
|
When you use Terraform on the command line with Terraform Cloud, many commands like `apply` run inside your Terraform Cloud environment. However, the `import` command runs locally, so it does 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.
|