A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.hashicorp.com/terraform/cli/import below:

Import existing infrastructure resources | Terraform

Import existing resources overview

This topic provides an overview of the Terraform commands that let you import existing infrastructure resources so that you can manage them with Terraform.

Hands-on: Try the Import Terraform Configuration tutorial.

You can import an existing resource to state from the Terraform CLI. You can also perform import operations using HCP Terraform. To import multiple resources, use the import block.

Import to state

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.

The terraform import CLI command can only import resources into the 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 expects each remote object to be bound to a single resource address. You should import each remote object to one Terraform resource address. Importing the same object multiple times may result in unwanted behavior. Refer to State for more details.

HCP Terraform

When you use Terraform on the command line with HCP Terraform, commands such as apply run inside your HCP Terraform environment. However, the import command runs locally, so it does not have access to information from HCP Terraform. To successfully perform an import, you may need to set local variables equivalent to any remote workspace variables in HCP Terraform.

Import multiple resources

You can specify multiple resources in the import block to import more than one resource at a time. You can also review imports as part of your normal plan and apply workflow. Refer to the import block reference in the Terraform configuration language documentation for addtitional information.

Each resource in Terraform must implement some basic logic to become importable. As a result, you cannot import all Terraform resources.

The resources that you can import are documented at the bottom of each resource documentation page in the Terraform Registry. If you have issues importing a resource, report an issue in the relevant provider repository.

To make a resource importable, refer to Extending Terraform: Resources — Import.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4