skills/terraform-search-import/SKILL.md
Adopt existing infrastructure into OpenTofu or Terraform state. Use when importing unmanaged resources, reconciling state with real infrastructure, auditing what already exists, or migrating manually created resources into IaC. In OpenTofu environments, prefer manual discovery plus import blocks or tofu import; do not default to Terraform Search or terraform query unless the user explicitly works in Terraform and that feature is available.
npx skillsauth add ederheisler/agent-skills terraform-search-importInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This repository is OpenTofu-first. That changes the default import workflow.
OpenTofu supports import blocks and the tofu import command, but Terraform Search and terraform query are Terraform-specific features and should not be the default path here.
tofu import.In this repository, assume step 2 unless the user says otherwise.
Use the provider's CLI, console, or API to discover the existing objects and their import IDs.
Examples:
Create the resource or module address where the object should live long-term.
for_each key, or count index.resource "aws_instance" "web" {
# Fill in the intended managed configuration.
}
Use import blocks when the import should be visible in version control and reviewed with the rest of the configuration.
import {
to = aws_instance.web
id = "i-1234567890abcdef0"
}
resource "aws_instance" "web" {
# Fill in the intended managed configuration.
}
In this repo:
cd terraform
tofu init
tofu plan -var-file=terraform.tfvars
tofu apply -var-file=terraform.tfvars
For a focused import review, a plain tofu plan is also acceptable when no tfvars are needed.
After import:
tofu importUse the CLI command when you need a one-off state attachment and do not want to keep an import block in the codebase.
tofu import aws_instance.web i-1234567890abcdef0
tofu import 'aws_iam_user.users["alice"]' alice
tofu import module.network.aws_vpc.main vpc-12345678
Prefer import blocks instead when the import is part of a code reviewable migration.
For many similar resources:
If you need a repeatable template for manual discovery, read references/MANUAL-IMPORT.md.
for_each, import directly into the keyed address.count, import directly into the indexed address.When adopting resources into this repo:
terraform/servers, server_defaults, and compartment-alias modelIf the user explicitly wants Terraform Search or terraform query, stop and confirm the runtime first.
Only use that path when all of the following are true:
Otherwise, fall back to the manual OpenTofu workflow.
terraform query in an OpenTofu repo.Before finishing an import/adoption task in this repository:
tofu fmt -recursive from terraform/ if HCL changed.tofu validate.tofu plan or tofu plan -var-file=terraform.tfvars to confirm the imported object matches the intended configuration.development
Extracts what the user actually wants instead of what they think they should want. Achieves this through one-question-at-a-time interview until ~95% confidence about the underlying intent. Use when an ask is underspecified ("build me X" without "for whom" or "why now"), when the user explicitly invokes ("interview me", "grill me", "are we sure?", "stress-test my thinking"), or when you catch yourself silently filling in ambiguous requirements before any plan, spec, or code exists.
testing
Refines raw ideas into sharp, actionable concepts through structured divergent and convergent thinking. Use when an idea is still vague, when you need to stress-test assumptions before committing to a plan, or when you want to expand options before converging on one. Triggers on "ideate", "refine this idea", or "stress-test my plan".
documentation
Compact the current conversation into a handoff document for another agent to pick up.
testing
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".