avm-tf-migration
Skill1 starsChanged 2 months agoMITView on GitHub
Use for AVM Terraform AzureRM-to-AzAPI migrations, state preservation, moved blocks, provider state moves, submodule extraction, upgrade tests, and post-migration specification compliance.
232 other projects use a version of this.
Adopted by
Most recently taken up by
- Azure/terraform-azurerm-avm-ptn-commercial-marketplaceword for word, first seen Oct 25, 2026
- Azure/terraform-azurerm-avm-ptn-aca-lza-hosting-environmentword for word, first seen Oct 15, 2026
- Azure/terraform-azurerm-avm-res-dataprotection-backupvaultword for word, first seen Oct 10, 2026
- Azure/terraform-azure-avm-res-signalrservice-webpubsubword for word, first seen Oct 1, 2026
- Azure/terraform-azure-avm-res-insights-privatelinkscopeword for word, first seen Sep 30, 2026
- Azure/terraform-azure-avm-res-app-agentword for word, first seen Sep 28, 2026
Other versions232 projects use a version of this.
Word for word · 232
- Azure/terraform-azurerm-avm-ptn-alz★ 135100% same
- Azure/terraform-azurerm-avm-res-keyvault-vault★ 50100% same
- Azure/terraform-azurerm-avm-ptn-aks-production★ 44100% same
- Azure/terraform-azurerm-avm-ptn-aiml-landing-zone★ 42100% same
- Azure/terraform-azurerm-avm-ptn-cicd-agents-and-runners★ 42100% same
- Azure/terraform-azurerm-avm-res-compute-virtualmachine★ 42100% same
- Azure/terraform-azurerm-avm-res-containerservice-managedcluster★ 42100% same
- Azure/terraform-azurerm-avm-res-storage-storageaccount★ 39100% same
- Azure/terraform-azurerm-avm-res-web-site★ 34100% same
- Azure/terraform-azurerm-avm-res-network-privatednszone★ 32100% same
222 more not listed
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- terraform/root/AGENTS.mdAGENTS.md
- terraform/root/.github/copilot-instructions.mdCopilot instructions
- avm-tf-azapiSkill
- avm-tf-classificationsSkill
- avm-tf-codestyleSkill
- avm-tf-conftestSkill
- avm-tf-documentationSkill
- avm-tf-interfacesSkill
- avm-tf-lifecycleSkill
- avm-tf-pattern-reviewSkill
- avm-tf-processSkill
- avm-tf-submodulesSkill
- avm-tf-telemetrySkill
- avm-tf-testingSkill
- avm-tf-tflintSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 9 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Read TFFR3-TFFR8, TFRMFR1, TFRMNFR1, TFRMNFR2, TFNFR38, and TFNFR39 through <https://azure.github.io/Azure-Verified-Modules/llms.txt> …
- Distinctive: line 18
Treat these as different graph migrations:
- Very specific: line 43
Do not move for_each inside the submodule to make state addresses easier.
- Very specific: line 64
Never hide a state-breaking extraction behind a claim that a wildcard moved block preserves it.
- Distinctive: line 68
When the providers support the state move, use a declarative block:
- Very specific: line 79
Keep migration blocks for the documented compatibility window and release them with clear upgrade notes.
- Distinctive: line 105
Do not retain AzureRM as a convenience fallback or copy it into target examples and tests.
- Distinctive: line 117
Use this for compile-time-static resource attributes, including a migration case where an imported server-assigned role-assignment name …
- Very specific: line 119
Use TFFR8 ignore_body_changes for consumer-selected body paths:
- Distinctive: line 129
Test against real state:
- Very specific: line 135
run terraform plan and require zero unintended destroys or replacements.
- Distinctive: line 137
run a second plan and require no changes.
- Distinctive: line 138
verify discrete outputs and all supported interfaces.
- Very specific: line 141
Use avm test integration for real-Azure Terraform tests and avm test e2e --example <name> for an example deployment.
- Distinctive: line 143
If state cannot be preserved, classify the change correctly under the current breaking-change and semantic-versioning specifications.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
AVM Terraform Migration
An AzureRM-to-AzAPI migration is complete only when the implementation satisfies the current AVM specifications and existing consumers have a documented, tested state path.
Migration guidance applies to existing modules only. AzureRM may be read, analyzed, and referenced as source input being migrated, including legacy azurerm_* state addresses. Generated target code uses AzAPI for every control-plane and supported Azure operation.
The target rule includes implementation, submodules, upgrade examples, E2E configurations, Terraform tests, fixtures, setup or teardown Terraform, documentation examples, and generated snippets. Supporting control-plane resources use AzAPI, and each standalone target Terraform root includes Azure/azapi in required_providers. Retain an azurerm_* resource or data-source block only when that block independently implements one specific unsupported data-plane/non-ARM operation. Document the exact block and why AzAPI cannot implement it with an upstream AzAPI issue or pull request, and replace the block when support ships. One valid block does not authorize another.
Read TFFR3-TFFR8, TFRMFR1, TFRMNFR1, TFRMNFR2, TFNFR38, and TFNFR39 through https://azure.github.io/Azure-Verified-Modules/llms.txt before choosing the migration shape.
Separate two changes
Treat these as different graph migrations:
- Provider migration in place:
azurerm_*to an AzAPI resource at the same module/cardinality boundary. - Composition migration: moving a resource across a module boundary, such as extracting a root collection into
module.child[each.key].azapi_resource.this.
Combining them makes state preservation harder and can make a reusable moved block impossible. Prefer migrating the provider in place first, releasing that state path, and extracting to a submodule in a later breaking release when needed.
Cardinality rule
TFRMNFR1 requires the parent module to own count or for_each. A submodule's primary resource manages one instance:
module "part" {
source = "./modules/part"
for_each = var.parts
}# modules/part/main.tf
resource "azapi_resource" "this" {
# No count or for_each here.
}Do not move for_each inside the submodule to make state addresses easier. That violates the target design.
A root collection address such as:
azurerm_example_part.this["a"]becomes:
module.part["a"].azapi_resource.thisTerraform cannot express a generic key-preserving resource-to-module move for every unknown consumer key. Options are:
- migrate the provider at the existing boundary first;
- migrate a resource already inside an existing
for_eachmodule call; - publish explicit consumer
terraform state mvinstructions for known keys; or - accept and document a breaking state migration when extraction itself is required.
Never hide a state-breaking extraction behind a claim that a wildcard moved block preserves it.
Provider migration in place
When the providers support the state move, use a declarative block:
moved {
from = azurerm_example_widget.this
to = azapi_resource.this
}For a same-level collection, moving the resource address can preserve its instances. Verify this against applied state; do not assume provider state conversion supports every resource.
Keep migration blocks for the documented compatibility window and release them with clear upgrade notes. Use direct terraform state mv only when no reusable declarative move exists, and provide PowerShell-friendly instructions:
terraform state list
terraform state mv 'azurerm_example_part.this["a"]' 'module.part["a"].azapi_resource.this'Back up state before imperative changes.
Target implementation checklist
The AzAPI target must include:
Azure/azapi ~> 2.12;- primary resource label
this; - required
parent_idand TFNFR38 resource ID validation; - standard TFNFR39 files in root and submodules;
typefrom the deterministicresource_typesobject;response_export_values, including an explicit empty value;replace_triggers_refsonly when replacement paths exist, using a non-empty static list of unique, valid JMESPath body paths;- consumer-configurable
retryand dynamictimeouts; - per-resource
ignore_body_changeswith empty lists collapsed tonull; - nested
resource_typesandignore_body_changesslots for submodules; - discrete outputs mapped from
azapi_resource.this.output; and - standard interfaces composed through
Azure/avm-utl-interfaces/azure ~> 0.6.
Do not retain AzureRM as a convenience fallback or copy it into target examples and tests. Existing AzureRM configuration is migration input only, except when the target still requires the narrowly documented unsupported data-plane/non-ARM operation.
Ignore semantics during migration
Static Terraform lifecycle references remain expressions:
lifecycle {
ignore_changes = [name]
}Use this for compile-time-static resource attributes, including a migration case where an imported server-assigned role-assignment name must remain stable.
Use TFFR8 ignore_body_changes for consumer-selected body paths:
ignore_body_changes = length(var.ignore_body_changes.example_widgets) > 0 ? var.ignore_body_changes.example_widgets : nullPaths are body-relative dot notation, cannot target list indices, and prevent ignored configuration from being sent to Azure. A change to the provider-private value takes effect only after apply.
Upgrade-path validation
Test against real state:
- deploy a representative example with the latest published pre-migration module;
- capture
terraform state listand a state backup; - switch the example to the local migrated module;
- run
terraform init -upgrade; - run
terraform planand require zero unintended destroys or replacements; - apply the migration;
- run a second plan and require no changes;
- verify discrete outputs and all supported interfaces; and
- destroy through the migrated implementation.
Use avm test integration for real-Azure Terraform tests and avm test e2e --example <name> for an example deployment. Run avm pre-commit, commit all results, and then run avm pr-check on a clean worktree.
If state cannot be preserved, classify the change correctly under the current breaking-change and semantic-versioning specifications. Document exact consumer commands and expected effects rather than silently accepting recreation.
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.

