agentleFS
jonathan-vellajonathan-vella/bmit-2026/.github/skills/terraform-search-import/SKILL.md

terraform-search-import

Skill3 starsChanged 8 months agoMITArchived repositoryView on GitHub

Discover existing Azure resources and bulk import them into Terraform management. USE FOR: import Azure resources, bring unmanaged infra under Terraform, audit Azure resources, migrate to IaC, terraform import, bulk import. WHEN: import existing resources, discover Azure infrastructure, adopt Terraform for existing resources, generate import blocks. DO NOT USE FOR: Bicep code, new resource creation, architecture decisions.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use type-specific commands: az vm list, az network vnet list, az storage account list, etc.

    line 50
  2. Very specific:

    Import ID format: /subscriptions/{sub}/resourceGroups/{rg}/providers/{type}/{name}

    line 77
  3. Very specific:

    After importing raw azurerm_* resources, refactor to AVM modules using moved {} blocks.

    line 81
  4. Distinctive:

    Use Terraform MCP tools during import workflows:

    line 86

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Terraform Search & Import for Azure

Discover existing Azure resources and generate Terraform configuration for bulk import.

References:


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.


Manual Discovery Workflow (Primary)

Step 1: Discover Resources with az CLI

az resource list --resource-group rg-contoso-prod --output table
az resource list --tag Environment=prod --output json

Use type-specific commands: az vm list, az network vnet list, az storage account list, etc.

Step 2: Create Import Blocks

For each resource, create a resource block + import block. See references/manual-import.md for full examples and bulk import scripts.

Step 3: Plan and Apply

terraform plan    # Review — should show import actions only
terraform apply   # Execute imports

Azure Resource Type ↔ Terraform Mapping

Azure TypeTerraform Resourceaz CLI
Microsoft.Resources/resourceGroupsazurerm_resource_groupaz group list
Microsoft.Network/virtualNetworksazurerm_virtual_networkaz network vnet list
Microsoft.Compute/virtualMachinesazurerm_linux_virtual_machineaz vm list
Microsoft.Storage/storageAccountsazurerm_storage_accountaz storage account list
Microsoft.KeyVault/vaultsazurerm_key_vaultaz keyvault list
Microsoft.Sql/serversazurerm_mssql_serveraz sql server list
Microsoft.Web/sitesazurerm_linux_web_appaz webapp list
Microsoft.App/containerAppsazurerm_container_appaz containerapp list

Import ID format: /subscriptions/{sub}/resourceGroups/{rg}/providers/{type}/{name}

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:

ToolPurpose
mcp_terraform_search_providersValidate resource type support in provider
mcp_terraform_get_provider_detailsGet resource schemas and import ID format
mcp_terraform_search_modulesFind AVM modules for post-import refactoring
mcp_terraform_get_latest_module_versionGet latest AVM module version

Terraform Search Workflow (Experimental)

Warning: Requires Terraform >= 1.14 and azurerm provider support for list_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

FileContents
references/manual-import.mdDetailed az CLI discovery, bulk import scripts, resource mapping
scripts/list_resources.shExtract supported list resources from providers

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.