aztfexport-skill
Skill0 starsChanged 9 months agoMITView on GitHub
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.
- Installs packages
In this repository97 other files it gives its agents.
- skills/obsidian-second-brain-skill/templates/CLAUDE.mdCLAUDE.md
- 1passwordSkill
- alz-accelerator-skillSkill
- ArgocdAppInstallSkill
- argocd-applicationset-skillSkill
- ArgocdClusterBootstrappingSkill
- argocd-cluster-bootstrappingSkill
- ArgoCdCommandSkill
- ArgocdImageUpdaterSkill
- argocd-image-updaterSkill
- ArgoCDReviewSkill
- argocd-cliSkill
- ArgoRolloutsSkill
- atuinSkill
- az-aks-agentSkill
- azure-ad-ssoSkill
- azure-devops-skillSkill
- azure-devops-wikiSkill
- AzureFinOpsSkill
- BmadOrchestrateSkill
- cloudflare-dnsSkill
- commit-skillSkill
- consulting-designSkill
- Context7Skill
- defectdojoSkill
- dependency-track-skillSkill
- direnvSkill
- external-dnsSkill
- external-urlsSkill
- GithubPagesSkill
- gitops-principles-skillSkill
- git-advanced-workflowsSkill
- git-advanced-workflowsSkill
- git-worktreeSkill
- grafana-skillSkill
- holmesgpt-skillSkill
- Iterm2Skill
- json-canvasSkill
- justfile-skillSkill
- k8s-clustersSkill
- k8s-timezone-configSkill
- kargo-skillSkill
- keyvault-csi-driverSkill
- knativeSkill
- lokiSkill
- looking-up-docsSkill
- macos-cleanerSkill
- macos-setupSkill
- managing-infraSkill
- markitdown-skillSkill
- merge-and-cleanup-skillSkill
- mimirSkill
- mkdocsSkill
- neovimSkill
- NotebookLMSkill
- obsidian-basesSkill
- obsidian-markdownSkill
- obsidian-master-skillSkill
- obsidian-nvimSkill
- obsidian-second-brainSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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 30
If mismatch (e.g., x86_64 binary on arm64 Mac), reinstall the correct architecture version.
- Very specific: line 36
Use Azure CLI to find the resource ID.
- Very specific: line 92
Consider renaming res-0 to descriptive names (update both HCL and state)
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
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):
If mismatch (e.g., x86_64 binary on arm64 Mac), reinstall the correct architecture version.file $(which aztfexport) # Check binary arch uname -m # Check system arch
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:
az resource list --query "[?name=='RESOURCE_NAME']" -o tableStep 2: Validate aztfexport Binary
file $(which aztfexport)
uname -m
aztfexport --versionArchitecture mismatch causes cryptic failures. Always verify before first use on a new machine.
Step 3: Run aztfexport
Single resource:
aztfexport resource \
--non-interactive \
--plain-ui \
-o ./terraform-export \
"/subscriptions/SUB_ID/resourceGroups/RG/providers/TYPE/NAME"Resource group:
aztfexport resource-group \
--non-interactive \
--plain-ui \
-o ./terraform-export \
RESOURCE_GROUP_NAMEAzure Resource Graph query:
aztfexport query \
--non-interactive \
--plain-ui \
-o ./terraform-export \
"resources | where name == 'MY_RESOURCE'"Step 4: Review Generated Files
ls ./terraform-export/
# Expect: main.tf, provider.tf, terraform.tfstate, import.tf (sometimes)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
cd ./terraform-export
terraform init
terraform planA 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
# Step 1: Find the resource ID
az monitor activity-log alert list -g myResourceGroup \
--query "[?name=='my-alert'].id" -o tsv
# Step 2: Export
aztfexport resource \
--non-interactive \
--plain-ui \
-o ./alert-export \
"/subscriptions/xxxx/resourceGroups/myRG/providers/Microsoft.Insights/activityLogAlerts/my-alert"
# Step 3: Verify
cd ./alert-export
terraform init
terraform planDoes 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.

