apex-terraform-search-import
Skill216 starsChanged 2 months agoMITView on GitHub
**WORKFLOW SKILL** — Manual-only discovery and import of existing Azure resources into Terraform management. WHEN: explicitly invoked as /apex-terraform-search-import for resource discovery or import planning. DO NOT USE FOR: automatic Terraform routing, Bicep code, new resource creation, architecture decisions. State changes require separate approval.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- apex-agent-authoringSkill
- apex-azure-adrSkill
- apex-azure-artifactsSkill
- apex-azure-bicep-patternsSkill
- apex-azure-cloud-migrateSkill
- apex-azure-complianceSkill
- apex-azure-computeSkill
- apex-azure-cost-optimizationSkill
- apex-azure-defaultsSkill
- apex-azure-deploySkill
- apex-azure-diagnosticsSkill
- apex-azure-governance-discoverySkill
- apex-azure-kubernetesSkill
- apex-azure-kustoSkill
- apex-azure-prepareSkill
- apex-azure-quotasSkill
- apex-azure-rbacSkill
- apex-azure-reliabilitySkill
- apex-azure-resourcesSkill
- apex-azure-storageSkill
- apex-azure-upgradeSkill
- apex-azure-validateSkill
- apex-context-managementSkill
- apex-entra-app-registrationSkill
- apex-github-operationsSkill
- apex-golden-principlesSkill
- apex-host-debug-log-exportSkill
- apex-host-git-commitSkill
- apex-host-workflow-startSkill
- apex-iac-commonSkill
- apex-mermaidSkill
- apex-microsoft-docsSkill
- apex-python-diagramsSkill
- apex-terraform-patternsSkill
- apex-terraform-testSkill
- apex-unslopSkill
- apex-vendor-promptingSkill
- apex-workflow-engineSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Do not auto-invoke it from a generic Terraform request.
- Distinctive: line 69
Use the saved-plan check in the manual reference before requesting approval.
- Very specific: line 79
After importing raw azurerm_* resources, refactor to AVM modules using moved {} blocks.
- Very specific: line 84
Use Azure MCP or Azure CLI to discover deployed resource IDs.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Terraform Search & Import for Azure
Manual-only: use /apex-terraform-search-import explicitly before this search/import workflow.
Do not auto-invoke it from a generic Terraform request. Invocation does not authorize state adoption or apply;
retain scope confirmation, import-only plan review and separate human authorization for state changes.
Discover existing Azure resources and generate Terraform configuration for bulk import.
References:
- Terraform Import
- Terraform Search (TF 1.14+)
Decision Tree
┌─ Identify target Azure resources
│
├─ PRIMARY: Manual Discovery via az CLI (always works)
│ └─ az resource list → create import blocks → terraform plan → apply
│
└─ SECONDARY: Terraform Search (EXPERIMENTAL)
├─ Check: terraform version >= 1.14?
│ └─ NO → use Manual workflow
├─ Check: azurerm supports list_resource_schemas for this type?
│ └─ UNKNOWN/NO → use Manual workflow
└─ YES to both → use Search workflowPrimary workflow = Manual Discovery via az CLI. Always works with azurerm ~> 4.0.
Search workflow is experimental — azurerm provider support for list_resource_schemas
is TBD. Use Manual Discovery as the reliable default.
Rules
- Manual Discovery is the primary path with
azurerm ~> 4.0and Azure CLI; Terraform Search is experimental and provider support is TBD. - Pin provider to
~> 4.0and retain the lockfile. Validate renamed 4.x attributes against the approved provider schema before import. - Plan before apply: save and review an import-only plan, with no creates, updates, deletes or replacements; state adoption/apply requires explicit human authorization.
- Adopt AVM modules post-import: raw
azurerm_*is acceptable as a temporary state; refactor withmoved {}blocks perapex-terraform-patternsreferences/refactor-module.md. - Document the source: record the originating
az resource listquery so discovery can be reproduced. - Out of scope: Bicep (
apex-azure-bicep-patterns), new resources (apex-terraform-patterns), architecture decisions (apex-azure-adr).
Manual Discovery Workflow (Primary)
Three-step procedure: (1) discover existing resources via az resource list (by resource
group, tag, or type-specific commands like az vm list); (2) generate resource + import
blocks for each (full examples and bulk import scripts in
references/manual-import.md); (3) terraform plan (review:
imports only — no creates / destroys) → terraform apply.
Use the saved-plan check in the manual reference before requesting approval;
discovery or generated import blocks do not authorize state changes.
Import ID format:
/subscriptions/{sub}/resourceGroups/{rg}/providers/{type}/{name}. The Azure-type ↔
Terraform-resource ↔ az CLI mapping table for the 8 most common services lives in
references/manual-import.md.
Post-Import: Adopt AVM Modules
After importing raw azurerm_* resources, refactor to AVM modules using moved {} blocks.
See apex-terraform-patterns skill references/refactor-module.md for guidance.
Provider and Module Metadata
Use Azure MCP or Azure CLI to discover deployed resource IDs. Use the public
Terraform Registry API for provider/module search and versions, then run
caller-approved terraform init preserving the lockfile, and
terraform providers schema -json for resource schemas. The
list helper only inspects schemas; it never initializes
or upgrades dependencies. A nonzero result means schema/initialization failure:
stop and diagnose it, not "Search unsupported". Only a successful empty list means
no list capability for the selected initialized provider.
The canonical commands and source boundaries are in
terraform-conventions.md.
Terraform Search Workflow (Experimental)
Warning: Requires Terraform >= 1.14 and
azurermprovider support forlist_resource_schemas(TBD). Use Manual Discovery above as primary path.
Uses .tfquery.hcl files with list blocks to discover resources, then
terraform query -generate-config-out=imported.tf to generate config.
Clean generated output by removing computed attrs, adding variables, applying CAF naming.
Reference Index
| File | Contents |
references/manual-import.md | Detailed az CLI discovery, bulk import scripts, resource mapping |
scripts/list_resources.sh | Extract supported list resources from providers |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

