julianobarbosa/claude-code-skills/aztfexport
Claude Code and agent skill by julianobarbosa/claude-code-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when exporting existing Azure resources to Terraform using aztfexport. Triggers on aztfexport, Azure import to Terraform, export Azure resource, bring Azure under Terraform management, reverse-engineer Azure infrastructure, bootstrap IaC from live Azure resources. Covers resource, resource-group, and query modes.
Install
npx vskill@latest install julianobarbosa/claude-code-skills/aztfexportSKILL.md
aztfexport — Export Azure Resources to Terraform
Overview
aztfexport is a Microsoft tool that exports existing Azure resources into Terraform HCL + state. It reverse-engineers live Azure infrastructure into Terraform configurations. Use this for Azure-only workflows or Terraform versions before 1.14's native terraform query.
When to Use
- Export a single Azure resource to Terraform →
aztfexport resource - Export an entire resource group →
aztfexport resource-group - Export resources matching an Azure Resource Graph query →
aztfexport query - Bootstrapping IaC from existing Azure infrastructure
Use `terraform-search-import` skill instead when: Terraform >= 1.14 with terraform query + bulk import (multi-cloud, not Azure-specific).
Prerequisites
- aztfexport installed:
brew install aztfexport(macOS) or see GitHub releases - Azure CLI authenticated:
az login+ correct subscription selected - Architecture check (critical on macOS):
``bash file $(which aztfexport) # Check binary arch uname -m # Check system arch `` If mismatch (e.g., x86_64 binary on arm64 Mac), reinstall the correct architecture version.
Workflow
Step 1: Discover the Resource ID
Use Azure CLI to find the resource ID. See references/RESOURCE-DISCOVERY.md for patterns by resource type.
Generic fallback:
Step 2: Validate aztfexport Binary
Architecture mismatch causes cryptic failures. Always verify before first use on a new machine.
Step 3: Run aztfexport
Single resource:
Resource group:
Azure Resource Graph query:
Step 4: Review Generated Files
main.tf— generated HCL withres-0style resource namesprovider.tf— AzureRM provider configurationterraform.tfstate— imported state file- Consider renaming
res-0to descriptive names (update both HCL and state)
Step 5: Verify
A clean plan (no changes) confirms successful export. Minor diffs may appear for computed attributes — review and suppress with lifecycle { ignore_changes } if appropriate.
Critical Flags
| Flag | Purpose | When Required | |
|---|---|---|---|
--non-interactive | Skip interactive prompts | Always in CI/headless/Claude | |
--plain-ui | Disable TUI (terminal UI) | Always pair with `--non-interactive` — without it, fails when no /dev/tty | |
-o <dir> | Output directory | Always (must be empty or non-existent) | |
--append | Append to existing Terraform dir | When adding to existing config (but see gotcha below) | |
--overwrite | Overwrite existing files | When re-exporting to same directory | |
--hcl-only | Generate HCL without importing state | When you only need the code |
Gotchas & Troubleshooting
| Problem | Cause | Solution | |
|---|---|---|---|
Binary crashes silently or exec format error | Architecture mismatch (x86 on ARM Mac) | Run file $(which aztfexport) + uname -m, reinstall correct arch | |
--non-interactive alone fails | No /dev/tty in headless environments | Always pair with --plain-ui | |
| "directory is not empty" error | Output dir has files | Use -o <fresh-dir> or --overwrite | |
--append fails on non-empty dir without state | aztfexport expects existing Terraform state | Use -o to a fresh subdirectory instead | |
| Can't find Azure resource ID | Resource type unknown or wrong API | Try multiple az commands — see RESOURCE-DISCOVERY.md | |
res-0 style names in output | Default aztfexport naming | Rename post-export in both HCL and state | |
terraform plan shows diffs after export | Computed/server-side attributes | Review diffs — use ignore_changes for benign ones |
Example: Export an Activity Log Alert
Gotchas
- Architecture mismatch between the aztfexport binary and the AzureRM provider's CGO bindings — Apple Silicon needs ARM64 build, x86 binary on M-series silently degrades.
- Resource-name regex defaults exclude special chars — resources with
.in the name (FQDNs, etc.) are skipped silently. - Generated `import` blocks (Terraform 1.5+) vs `state import` commands — aztfexport now writes blocks; older workflows expecting state-import calls break.
- `--include-role-assignment` is OFF by default — RBAC is left out of state, which is usually exactly what you don't want.
- Provider version pinning: aztfexport pins to specific AzureRM versions in its imports; mismatched provider in your target stack causes spurious plan diffs.
- Non-interactive (`-n`) skips name customization — auto-generated TF names like
azurerm_storage_account_001end up in your code permanently if not reviewed.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/aztfexport/SKILL.md
Popularity
- Repository stars
- 84
- Repository forks
- 18
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/julianobarbosa/claude-code-skills/aztfexport)