terraform-search-import
Discover existing cloud resources using Terraform Search queries and bulk import them into Terraform management. Use when bringing unmanaged infrastructure under Terraform control, auditing cloud resources, or migrating to IaC.
Security Assessment
Detected risks:
About terraform-search-import
The terraform-search-import skill enables users to discover existing cloud resources through Terraform Search queries and efficiently bring them under Terraform management. It solves the problem of managing previously unmanaged infrastructure by automating the discovery and configuration generation process. This skill is particularly useful when organizations want to audit their cloud resources, migrate from manually provisioned infrastructure to Infrastructure as Code (IaC), or maintain compliance by ensuring all resources are tracked in Terraform state.
The skill’s core features include the ability to define declarative search queries using `.tfquery.hcl` files, support for provider authentication through `provider` blocks, and the capability to generate both `resource` and `import` blocks automatically. Users can utilize helper scripts to identify supported resources per provider and verify Terraform version compatibility. The workflow supports bulk imports and offers a structured process: create queries, run `terraform query`, generate configuration, review, and finally apply the imports. The skill also accommodates optional filters and parameterization through `variable` and `locals` blocks, giving flexibility in targeting specific resources or environments.
Targeted at DevOps engineers, cloud architects, and infrastructure teams, terraform-search-import is ideal for scenarios like bringing unmanaged resources under Terraform control, auditing multi-region or multi-account deployments, and migrating existing infrastructure to IaC practices. By providing a guided, repeatable process for discovering and importing resources, it reduces manual effort, minimizes errors during import, and ensures that infrastructure management adheres to Terraform best practices.
FAQ
Which Terraform versions are compatible with terraform-search-import?
This skill requires Terraform version 1.14 or higher. Users should verify that the target resource type is supported by their provider and that the provider version is up to date.
How do I check if my provider supports the resources I want to import?
Run the helper script `./scripts/list_resources.sh <provider>` or query the provider schema manually with `terraform providers schema -json`. This ensures that the resources are available for listing and import.
Can I use terraform-search-import for resources not supported by Terraform Search?
No. For unsupported resources or Terraform versions below 1.14, you should use the Manual Discovery workflow described in MANUAL-IMPORT.md.
What is the typical workflow for importing resources?
The workflow involves creating `.tfquery.hcl` files with `list` blocks, running `terraform query` to discover resources, generating configuration files, reviewing the generated `resource` and `import` blocks, and applying them with `terraform plan` and `terraform apply`.
Do I need to initialize my Terraform working directory before running queries?
Yes. Terraform Search requires an initialized working directory with the required provider configured. Run `terraform init` before executing search queries.
Install terraform-search-import
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
hashicorp/agent-skills