terraform-search-import

Discover existing cloud resources with Terraform Search queries and bulk import them into Terraform state.

Updated Jun 13, 2026
One-click install
npx skills add https://github.com/jenreh/project-kit-template --skill terraform-search-import-jenreh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-search-import
Source: https://github.com/jenreh/project-kit-template/tree/main/.agents/agent-skills/skills/terraform-search-import
Command: npx skills add https://github.com/jenreh/project-kit-template --skill terraform-search-import-jenreh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Bringing unmanaged cloud infrastructure under Terraform control traditionally requires manually identifying every resource and writing import blocks by hand. This Skill automates discovery of existing resources using Terraform Search queries and generates the configuration needed for bulk import. ## Core Features & Use Cases - Declarative Resource Discovery: Write .tfquery.hcl files with list blocks to find resources by tags, type, region, or other provider-specific filters. - Bulk Configuration Generation: Run terraform query -generate-config-out to automatically produce resource and identity-based import blocks for all discovered resources. - Provider Support Detection: Use the included list_resources.sh script to verify which resource types your provider version supports before starting. - Manual Import Fallback: A reference guide covers CLI-based discovery and config-driven import for resource types not yet supported by Terraform Search. - Use Case: Your team has dozens of EC2 instances created manually across three regions. Write a multi-region query filtered by owner tag, generate the configuration, clean up computed attributes, and import everything into state in one workflow. ## Quick Start Ask the AI to discover all running EC2 instances tagged with your team name across your AWS regions and generate the Terraform configuration to import them into state.

Frequently Asked Questions about terraform-search-import

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I import existing AWS resources into Terraform?

Use Terraform Search by writing a `.tfquery.hcl` file with `list` blocks targeting your resource type, then run `terraform query -generate-config-out=imported.tf`. Review the generated resource and import blocks, clean up computed attributes, and run `terraform apply`.

How to bulk import EC2 instances into Terraform state?

Create a query file with a `list "aws_instance"` block, optionally filtered by tags or instance type, and run `terraform query -generate-config-out`. Terraform generates resource blocks plus identity-based import blocks for every matching instance.

Which Terraform version supports Terraform Search and bulk import?

Terraform Search requires Terraform 1.14 or later, and the provider must support list resources for your target resource type. Run the included `list_resources.sh` script to check which list resources your provider version exposes.

What if my resource type is not supported by Terraform Search?

Use the manual import workflow: discover resources with the provider CLI (for example `aws rds describe-db-instances`), write resource blocks by hand, and add config-driven `import` blocks with the resource ID. Then run `terraform plan` and `terraform apply`.

Why does terraform query return no list resources found?

This usually means your provider version does not support list resources or the working directory is not initialized. Run `terraform init -upgrade`, use the latest provider version, and verify support with `terraform providers schema -json` or the helper script.