terraform-search-import
- Repo stars 0
- Author repo skills-registry
Terraform Search & Import for Azure
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 workflow
Primary 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 — always works with
azurerm ~> 4.0and Azure CLI; Terraform Search is experimental and provider support is TBD - Pin provider to
~> 4.0— azurerm 4.x renamed many attributes (allow_blob_public_access→allow_nested_items_to_be_public, etc.); pinning to anything else causes drift after import - Plan before apply — always run
terraform planafter generating import blocks; the plan should show import actions ONLY (no creates / destroys) - Adopt AVM modules post-import — raw
azurerm_*is acceptable as a temporary state; refactor toAzure/avm-res-*modules withmoved {}blocks (seeterraform-patternsreferences/refactor-module.md) - Document the source — in the imported
resourceblock, comment the originatingaz resource listquery so future runs can be reproduced - Out of scope: Bicep code (use
azure-bicep-patterns), new resource creation (useterraform-patterns), architecture decisions (useazure-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.
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 terraform-patterns skill references/refactor-module.md for guidance.
Integration with Terraform MCP
Use Terraform MCP tools during import workflows:
| Tool | Purpose |
|---|---|
mcp_terraform_search_providers |
Validate resource type support in provider |
mcp_terraform_get_provider_details |
Get resource schemas and import ID format |
mcp_terraform_search_modules |
Find AVM modules for post-import refactoring |
mcp_terraform_get_latest_module_version |
Get latest AVM module version |
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 |
<!-- tomevault:4.0:skill_md:2026-05-22 -->Source: aivandelindt/azure-agentic-infraops — distributed by TomeVault.
- Fluxly category
- DevOps
- Author-declared agents
- No explicit declaration found; this is not inferred or tested compatibility
- Static check
- 88 / 100 · heuristic scan, not runtime safety proof
- Author / version / license
- @tomevault-io · no license declared
- Fluxly token estimate
- Lean
- Fluxly setup estimate
- Plug-and-play
- External API key
- No requirement detected
- Detected OS requirements
- Unspecified
- Runtime requirements
- Unspecified
- Detected file/system behavior
-
- Read-only
- Write / modify
- Detected network behavior
- Local-only
- Install commands
- None (reference only)
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
The current SKILL.md does not define a fixed output example. 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
Warning: Requires Terraform >= 1.14 and azurerm provider support for listresourceschemas (TBD). Use Manual Discovery above as primary path. Uses .tfquery.hcl files with list blocks to discover resources, then
# Terraform Search & Import for Azure
Discover existing Azure resources and generate Terraform configuration for bulk import.
**References:**
- [Terraform Import](https://developer.hashicorp.com/terraform/language/import)
- [Terraform Search](https://developer.hashicorp.com/terraform/language/block/tfquery/list) (TF 1.14+)
---
## Decision Tree
```text
┌─ 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 workflow
```
**Primary 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** — always works with `azurerm ~> 4.0` and Azure CLI; Terraform Search is experimental and provider support is TBD
- **Pin provider to `~> 4.0`** — azurerm 4.x renamed many attributes (`allow_blob_public_access` → `allow_nested_items_to_be_public`, etc.); pinning to anything else causes drift after import
- **Plan before apply** — always run `terraform plan` after generating import blocks; the plan should show import actions ONLY (no creates / destroys)
- **Adopt AVM modules post-import** — raw `azurerm_*` is acceptable as a temporary state; refactor to `Azure/avm-res-*` modules with `moved {}` blocks (see `terraform-patterns` `references/refactor-module.md`)
… Author text anchors workflow facts; Fluxly only indexes current sections, terms, files, and commands.
sections -> Decision Tree → Rules → Manual Discovery Workflow (Primary) → Post-Import: Adopt AVM Modules → Integration with Terraform MCP → Terraform Search Workflow (Experimental)
terms -> References · Primary workflow = Manual Discovery · Search workflow is experimental · Manual Discovery is the primary path · Pin provider to ~> 4.0 · Plan before apply · Adopt AVM modules post-import · Document the source
files/cmd -> azurerm · listresourceschemas · azurerm ~> 4.0 · ~> 4.0 · allowblobpublicaccess · allownesteditemstobepublic · terraform plan · Azure/avm-res-
body sha256 -> af28b33b8fcd
Decide Fit First
Design Intent
How To Use It
Boundaries And Review