diff --git a/content/terraform-docs-agents/v1.25.x/docs/cloud-docs/agents/agents.mdx b/content/terraform-docs-agents/v1.25.x/docs/cloud-docs/agents/agents.mdx index 9e38c9ad02..73a80a03dc 100644 --- a/content/terraform-docs-agents/v1.25.x/docs/cloud-docs/agents/agents.mdx +++ b/content/terraform-docs-agents/v1.25.x/docs/cloud-docs/agents/agents.mdx @@ -85,8 +85,6 @@ The optional configurations for customizing the agent include building a custom ### Enable search queries -@include 'beta.mdx' - You can query your existing infrastructure to find resources that are not yet managed by Terraform. This makes it easier to identify and import unmanaged resources into your Terraform workspace. Refer to [Import existing resources to state](terraform/cloud-docs/workspaces/import) for more information. To use the search functionality, you must include the `query` operation in the [`TFE_AGENT_ACCEPT` variable](#accept) when starting your agent. diff --git a/content/terraform-docs-common/data/cloud-docs-nav-data.json b/content/terraform-docs-common/data/cloud-docs-nav-data.json index 515c39eacb..d5240f70e6 100644 --- a/content/terraform-docs-common/data/cloud-docs-nav-data.json +++ b/content/terraform-docs-common/data/cloud-docs-nav-data.json @@ -298,12 +298,7 @@ { "title": "Import existing resources", "path": "workspaces/import", - "alias": "search, terraform search, resource discoverability", - "badge": { - "text": "BETA", - "type": "outlined", - "color": "neutral" - } + "alias": "search, terraform search, resource discoverability" }, { "title": "Policy enforcement", diff --git a/content/terraform-docs-common/docs/cloud-docs/workspaces/import.mdx b/content/terraform-docs-common/docs/cloud-docs/workspaces/import.mdx index d27309a7b2..5287df8865 100644 --- a/content/terraform-docs-common/docs/cloud-docs/workspaces/import.mdx +++ b/content/terraform-docs-common/docs/cloud-docs/workspaces/import.mdx @@ -6,15 +6,13 @@ tfc_only: true # Import existing resources to state -Terraform can search your existing infrastructure for resources to let you import any unmanaged resources to an HCP Terraform workspace in bulk. For instructions on importing single resources or small batches of resources in your configuration, refer to [Import a single resource](/terraform/language/v1.14.x/import/single-resource). - -@include 'beta.mdx' +Terraform can search your existing infrastructure for resources to let you import any unmanaged resources to an HCP Terraform workspace in bulk. For instructions on importing single resources or small batches of resources in your configuration, refer to [Import a single resource](/terraform/language/import/single-resource). ## Overview You can search for unmanaged resources in [UI and VCS-driven](/terraform/cloud-docs/run/ui) and [CLI-driven](/terraform/cloud-docs/run/cli) workspaces. HCP Terraform presents results so that you can use the UI to import the resources and begin managing them as code. Complete the following steps to search for resources and import them into your Terraform state: -1. **Define queries**: Add `list` blocks to your Terraform configuration. If you are using the VCS-driven workflow, commit this change and push it to the repository associated with your workspace in HCP Terraform. Refer to [Import resources in bulk](/terraform/language/v1.14.x/import/bulk) for more information. +1. **Define queries**: Add `list` blocks to your Terraform configuration. If you are using the VCS-driven workflow, commit this change and push it to the repository associated with your workspace in HCP Terraform. Refer to [Import resources in bulk](/terraform/language/import/bulk) for more information. 1. **Run the queries**: You can run queries in the HCP Terraform UI or run the Terraform CLI on your local workstation. 1. **Review search results**: HCP Terraform shows the management status for resources it finds. 1. **Generate code**: HCP Terraform generates `import` and `resource` blocks for the resources it discovers. @@ -26,13 +24,13 @@ If you use HCP Terraform agents for your runs, you must enable the `query` opera ## Requirements -You must enable Terraform 1.14.0-beta or newer for your workspace to access the **Search & Import** page. Refer to the [general workspace settings documentation](/terraform/cloud-docs/workspaces/settings#general) for more information about changing workspace settings. +You must enable Terraform 1.14.0 or newer for your workspace to access the **Search & Import** page. Refer to the [general workspace settings documentation](/terraform/cloud-docs/workspaces/settings#general) for more information about changing workspace settings. HCP Terraform identifies resources managed by other workspaces when the workspace uses Terraform v1.12 and newer. ## Define queries -Add `list` blocks to your workspace's Terraform configuration to create search queries you want to run against your existing infrastructure. Refer to [Import resources in bulk](/terraform/language/v1.14.x/import/bulk) for instructions on how to define queries. +Add `list` blocks to your workspace's Terraform configuration to create search queries you want to run against your existing infrastructure. Refer to [Import resources in bulk](/terraform/language/import/bulk) for instructions on how to define queries. If HCP Terraform is connected to your VCS, commit the configuration to version control. @@ -52,11 +50,11 @@ As the query progresses, HCP Terraform loads the results to the page. In the **IaC** column, HCP Terraform indicates one of the following statuses for resources returned by the query: - - **Managed** indicates that the resource has the same [identity](/terraform/language/v1.14.x/import#resource-identity) as a resource applied by a similar provider version. - - **Unknown** indicates that the resource has the same [identity](/terraform/language/v1.14.x/import#resource-identity) as a resource applied by an older version of Terraform or older provider version. + - **Managed** indicates that the resource has the same [identity](/terraform/language/import#resource-identity) as a resource applied by a similar provider version. + - **Unknown** indicates that the resource has the same [identity](/terraform/language/import#resource-identity) as a resource applied by an older version of Terraform or older provider version. - **Unmanaged** indicates that there are no managed resources of this type or that Terraform can't attribute this resource to a similar provider and Terraform version. -Over time, providers may change their [resource identity](/terraform/language/v1.14.x/import#resource-identity) definitions, but HCP Terraform attempts to capture all resource identities as providers evolve. When a schema for a resource type changes between versions, HCP Terraform may list a resource as **Unknown** instead of **Unmanaged** when a resource was applied by one version of a provider but queried by a different version. +Over time, providers may change their [resource identity](/terraform/language/import#resource-identity) definitions, but HCP Terraform attempts to capture all resource identities as providers evolve. When a schema for a resource type changes between versions, HCP Terraform may list a resource as **Unknown** instead of **Unmanaged** when a resource was applied by one version of a provider but queried by a different version. You can perform the following actions in the results area: @@ -75,7 +73,7 @@ Copy the code to your Terraform configuration and apply the configuration. Befor Use one of the following methods to apply the configuration: - Navigate to your workspace in HCP Terraform and click **New run**. -- Run the `terraform apply` command on the remote workstation. +- Run the `terraform apply` command on your workstation. - If your workspace is configured to run on VCS changes, check the updated configuration into your VCS to trigger a new run. ## Next steps diff --git a/content/terraform/v1.13.x/docs/cli/commands/import.mdx b/content/terraform/v1.13.x/docs/cli/commands/import.mdx index 5358752b13..994d8452c7 100644 --- a/content/terraform/v1.13.x/docs/cli/commands/import.mdx +++ b/content/terraform/v1.13.x/docs/cli/commands/import.mdx @@ -9,12 +9,6 @@ The `terraform import` command imports existing resources into Terraform. Refer > **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 `v1.14.x (beta)` lets you search existing infrastructure for resources, generate configuration, and import them in bulk. Refer to the [Import existing resources in bulk](/terraform/language/v1.14.x/import/bulk) beta documentation for more information. - - - ## Usage Usage: `terraform import [options] ADDRESS ID` diff --git a/content/terraform/v1.13.x/docs/cli/import/index.mdx b/content/terraform/v1.13.x/docs/cli/import/index.mdx index 9b2c47a229..e44648fe56 100644 --- a/content/terraform/v1.13.x/docs/cli/import/index.mdx +++ b/content/terraform/v1.13.x/docs/cli/import/index.mdx @@ -10,12 +10,6 @@ This topic provides an overview of the Terraform commands that let you import ex > **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 `v1.14.x (beta)` lets you search existing infrastructure for resources, generate configuration, and import them in bulk. Refer to the [Import existing resources in bulk](/terraform/language/v1.14.x/import/bulk) beta documentation for more information. - - - ## Workflows 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. diff --git a/content/terraform/v1.13.x/docs/cli/import/usage.mdx b/content/terraform/v1.13.x/docs/cli/import/usage.mdx index 1b8c063371..ea9ddc2def 100644 --- a/content/terraform/v1.13.x/docs/cli/import/usage.mdx +++ b/content/terraform/v1.13.x/docs/cli/import/usage.mdx @@ -9,12 +9,6 @@ This topic describes how to use the `terraform import` command to import existin > **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 `v1.14.x (beta)` implements a new workflow for searching existing infrastructure for resources, generating configuration, and importing them in bulk. Refer to the [Import existing resources in bulk](/terraform/language/v1.14.x/import/bulk) beta documentation for more information. - - - ## Overview Use the `terraform import` command to import existing infrastructure to Terraform state. The `terraform import` command can only import one resource at a time. It cannot simultaneously import an entire collection of resources, such as an AWS VPC. diff --git a/content/terraform/v1.13.x/docs/language/block/import.mdx b/content/terraform/v1.13.x/docs/language/block/import.mdx index 0de496019c..f165173417 100644 --- a/content/terraform/v1.13.x/docs/language/block/import.mdx +++ b/content/terraform/v1.13.x/docs/language/block/import.mdx @@ -8,12 +8,6 @@ description: >- The `import` block instructs Terraform to import existing infrastructure resources into Terraform. Refer to [Import existing resources](/terraform/language/import) for more information. - - -Terraform `v1.14.x (beta)` lets you configure queries to search your existing infrastructure for resources and generate configuration to import them. Refer to the [list block reference](/terraform/language/v1.14.x/block/tfquery/list) beta documentation for more information. - - - ## Configuration model An `import` block supports the following configuration: diff --git a/content/terraform/v1.13.x/docs/language/import/generating-configuration.mdx b/content/terraform/v1.13.x/docs/language/import/generating-configuration.mdx index 3fe7337d5e..6a0dad2694 100644 --- a/content/terraform/v1.13.x/docs/language/import/generating-configuration.mdx +++ b/content/terraform/v1.13.x/docs/language/import/generating-configuration.mdx @@ -6,19 +6,13 @@ description: >- # Generating configuration -Terraform can generate code for the resources you define in [`import` blocks](/terraform/language/import) that do not already exist in your configuration. Terraform produces HCL to act as a template that contains Terraform's best guess at the appropriate value for each resource argument. +This topic describes how to generate code for single resources or small batches of resources defined in [`import` blocks](/terraform/language/import). For instructions querying your existing infrastructure for resources and generating `import` configuration based on search results, refer to the [Import existing resources in bulk](/terraform/language/import/bulk). ~> **Experimental:** Configuration generation is available in Terraform v1.5 as an experimental feature. Later minor versions may contain changes to the formatting of generated configuration and behavior of the `terraform plan` command using the `-generate-config-out` flag. - - -Terraform `v1.14.x (beta)` lets you configure queries to search your existing infrastructure for resources and generate configuration to import them. Refer to the [Import existing resources in bulk](/terraform/language/v1.14.x/import/bulk) beta documentation for more information. - - - Starting with Terraform's generated HCL, we recommend iterating to find your ideal configuration by removing some attributes, adjusting the value of others, and rearranging `resource` blocks into files and modules as appropriate. -To generate configuration, run `terraform plan` with the `-generate-config-out` flag and supply a new file path. Do not supply a path to an existing file, or Terraform throws an error. +To generate configuration, run `terraform plan` with the `-generate-config-out` flag and supply a new file path. Do not supply a path to an existing file, or Terraform throws an error. Terraform produces HCL to act as a template that contains Terraform's best guess at the appropriate value for each resource argument. ```shell $ terraform plan -generate-config-out="generated_resources.tf" diff --git a/content/terraform/v1.13.x/docs/language/import/index.mdx b/content/terraform/v1.13.x/docs/language/import/index.mdx index af37730820..6bf7b8d87d 100644 --- a/content/terraform/v1.13.x/docs/language/import/index.mdx +++ b/content/terraform/v1.13.x/docs/language/import/index.mdx @@ -9,12 +9,6 @@ You can import existing infrastructure resources into your Terraform state so th > **Hands-on:** Try the [State Import](/terraform/tutorials/state/state-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. - - -Terraform `v1.14.x (beta)` implements a new workflow for searching existing infrastructure for resources, generating configuration, and importing them in bulk. Refer to the [Import existing resources in bulk](/terraform/language/v1.14.x/import/bulk) beta documentation for more information. - - - ## Overview When you import existing infrastructure into state, you must also define the Terraform configuration corresponding to that resource to manage the rest of its lifecycle. You can manually write all of the configuration or use the Terraform CLI to generate configuration for resources your are importing. When you import resources, Terraform pulls all of the resource's attributes into the state file, but you do not need to define all of them in the `resource` block. diff --git a/content/terraform/v1.14.x/data/language-nav-data.json b/content/terraform/v1.14.x/data/language-nav-data.json index e9fae3b2a9..4d5633fc2d 100644 --- a/content/terraform/v1.14.x/data/language-nav-data.json +++ b/content/terraform/v1.14.x/data/language-nav-data.json @@ -213,7 +213,8 @@ { "title": "Overview", "path": "import"}, { "title": "Import resources in bulk", - "path": "import/bulk" + "path": "import/bulk", + "alias": "search, terraform search, query, list" }, { "title": "Import a single resource", "path": "import/single-resource" }, { @@ -384,11 +385,7 @@ { "title": "list", "path": "block/tfquery/list", - "badge": { - "text": "BETA", - "type": "outlined", - "color": "neutral" - } + "alias": "search, terraform search" }, { "title": "locals", diff --git a/content/terraform/v1.14.x/docs/language/block/tfquery/list.mdx b/content/terraform/v1.14.x/docs/language/block/tfquery/list.mdx index dab82ec8ef..b5e1df4185 100644 --- a/content/terraform/v1.14.x/docs/language/block/tfquery/list.mdx +++ b/content/terraform/v1.14.x/docs/language/block/tfquery/list.mdx @@ -8,8 +8,6 @@ description: |- The `list` block defines a query that reads existing infrastructure and returns resources that you can import to your Terraform workspace. You can only add `list` blocks to configuration files with `.tfquery.hcl` extensions. This topic provides reference information about configuring `list` blocks in `.tfquery.hcl` files. Refer to [Import existing resources in bulk](/terraform/language/import/bulk) for information about querying and importing resources. -@include 'beta.mdx' - ## Configuration model A `list` block supports the following configuration: diff --git a/content/terraform/v1.14.x/docs/language/import/bulk.mdx b/content/terraform/v1.14.x/docs/language/import/bulk.mdx index 374c5967bd..4fbe68a7b7 100644 --- a/content/terraform/v1.14.x/docs/language/import/bulk.mdx +++ b/content/terraform/v1.14.x/docs/language/import/bulk.mdx @@ -1,14 +1,12 @@ --- page_title: Import existing resources in bulk -description: Learn how to query existing infrastructure for unmanaged resources so you can import them into Terraform in bulk +description: Learn how to use Terraform search functionality to query existing infrastructure for unmanaged resources so that you can import them into Terraform state in bulk --- # Import existing resources in bulk You can configure queries that instruct Terraform to search your existing infrastructure for unmanaged resources. Terraform can also generate configuration for importing the resources it finds so that you can import them to your Terraform workspace in bulk. For information about importing single resources or small batches of resources, refer to [Import single resources](/terraform/language/import/single-resource) for instructions. -@include 'beta.mdx' - ## Introduction For organizations with large sets of infrastructure resources, manually identifying and importing them is tedious and labor intensive, even when using third-party tools or custom scripts. To alleviate this burden, you can write HCL-based queries and run them with the Terraform CLI to retrieve unmanaged resources so that you can import them in bulk. @@ -26,18 +24,7 @@ Terraform v1.12 or newer is required to search for resources according to their ### Supported providers -Verify that the resource type you want to search for is supported. For the initial beta release, you can use `list` blocks to query for the following resource types. This list may change. Refer to your provider documentation for the most up-to-date information. - -#### AWS provider - -- [`aws_batch_job_queue`](https://github.com/hashicorp/terraform-provider-aws/blob/main/website/docs/list-resources/batch_job_queue.html.markdown) -- [`aws_cloudwatch_log_group`](https://github.com/hashicorp/terraform-provider-aws/blob/main/website/docs/list-resources/cloudwatch_log_group.html.markdown) -- [`aws_iam_role`](https://github.com/hashicorp/terraform-provider-aws/blob/main/website/docs/list-resources/iam_role.html.markdown) -- [`aws_instance`](https://github.com/hashicorp/terraform-provider-aws/blob/main/website/docs/list-resources/instance.html.markdown) - -#### AWS CC provider - -All resources in this provider support `list` blocks. Because this provider is fully generated and doesn't accept provider-specific configurations, omit the `config` block when defining queries for AWS CC resources. +Verify that the resource type you want to search for is supported. Refer to your provider documentation for the most up-to-date information. ## Define a query @@ -120,8 +107,6 @@ If HCP Terraform is connected to your version control system (VCS), you can also After copying the configuration to your HCP Terraform workspace, you can either run the query locally using the Terraform CLI or run the query in the HCP Terraform UI. Refer to [Import existing resources to state](/terraform/cloud-docs/workspaces/import) in the HCP Terraform documentation for instructions on how to run queries and import resources from the UI. -Refer to [Import existing resources to state in bulk](/terraform/cloud-docs/workspaces/import) in the HCP Terraform documentation for details. - ### Terraform CLI Run the [`terraform query` command](/terraform/cli/commands/query) to retrieve the resource types specified in your `list` blocks. The command prints the results to your console. By default, each result includes the following information: diff --git a/content/terraform/v1.14.x/docs/language/import/generating-configuration.mdx b/content/terraform/v1.14.x/docs/language/import/generating-configuration.mdx index e717036a63..c90767f89a 100644 --- a/content/terraform/v1.14.x/docs/language/import/generating-configuration.mdx +++ b/content/terraform/v1.14.x/docs/language/import/generating-configuration.mdx @@ -6,6 +6,8 @@ description: >- # Generating configuration +This topic describes how to generate code for single resources or small batches of resources defined in [`import` blocks](/terraform/language/block/import). For instructions querying your existing infrastructure for resources and generating `import` configuration based on search results, refer to the [Import existing resources in bulk](/terraform/language/import/bulk). + ~> **Experimental:** Configuration generation is available in Terraform v1.5 as an experimental feature. Later minor versions may contain changes to the formatting of generated configuration and behavior of the `terraform plan` command using the `-generate-config-out` flag. Terraform can generate code for the resources you define in [`import` blocks](/terraform/language/import) that do not already exist in your configuration. Terraform produces HCL to act as a template that contains Terraform's best guess at the appropriate value for each resource argument. diff --git a/content/terraform/v1.14.x/docs/language/import/single-resource.mdx b/content/terraform/v1.14.x/docs/language/import/single-resource.mdx index 18bfbc807b..ed5d5ec5a8 100644 --- a/content/terraform/v1.14.x/docs/language/import/single-resource.mdx +++ b/content/terraform/v1.14.x/docs/language/import/single-resource.mdx @@ -5,11 +5,10 @@ description: Learn how to import existing resources into Terraform state so that # Import a single resource -You can import existing infrastructure resources into your Terraform state so that you can begin managing them using Terraform. This page describes how to write Terraform configuration for importing resources, which lets you import multiple resources at the same time and review the import as part of your Terraform workflow. +You can import existing infrastructure resources into your Terraform state so that you can begin managing them using Terraform. This page describes how to write Terraform configuration for importing resources. For instructions on how to query your existing infrastructure for resources and importing them in bulk, refer to [Import existing resources in bulk](/terraform/language/import/bulk). > **Hands-on:** Try the [State Import](/terraform/tutorials/state/state-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. - ## Overview When you import existing infrastructure into state, you must also define the Terraform configuration corresponding to that resource to manage the rest of its lifecycle. You can manually write all of the configuration or use the Terraform CLI to generate configuration for resources your are importing. When you import resources, Terraform pulls all of the resource's attributes into the state file, but you do not need to define all of them in the `resource` block.