avm-tf-testing
Skill1 starsChanged 2 months agoMITView on GitHub
Use for AVM Terraform validation, provider-mocked unit tests, real-Azure integration tests, E2E example tests, PowerShell hooks, OIDC, policy checks, and Avm.Authoring CI behavior.
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-migrationSkill
- avm-tf-pattern-reviewSkill
- avm-tf-processSkill
- avm-tf-submodulesSkill
- avm-tf-telemetrySkill
- 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, 6 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use PowerShell 7.4 or later with the Avm.Authoring module.
- Very specific: line 27
Always name the tier when tests are expected.
- Very specific: line 33
Place tests in tests/unit.
- Very specific: line 35
Every new resource-deploying module therefore mocks azapi.
- Very specific: line 57
Use mocked apply so computed values and resource creation paths can be asserted without Azure.
- Very specific: line 70
Place real-Azure Terraform tests in tests/integration.
- Distinctive: line 113
Use hooks only for required environment preparation or cleanup.
- Distinctive: line 125
After reviewing and committing all changes:
- Distinctive: line 135
Use the governance-managed reusable Terraform workflow.
- Distinctive: line 136
Use OIDC and a user-assigned identity or equivalent secretless federation.
- Distinctive: line 137
Keep test environments least privilege and isolate subscriptions where practical.
- Very specific: line 138
Treat skipped as different from pass.
- Distinctive: line 143
Run the smallest command that reproduces the issue:
- Very specific: line 153
Use -Path <module-directory> when testing a module outside the current directory and -Ecosystem terraform when context detection is …
- Very specific: line 155
When direct Terraform debugging is necessary, keep its flags consistent with the authoring engine and return to the avm command for final …
≈ “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 Testing
Use PowerShell 7.4 or later with the Avm.Authoring module. The old repository launcher, Make targets, Porch flags, and container workflow are retired.
Install-PSResource -Name Avm.Authoring -Repository PSGallery -TrustRepository
Import-Module Avm.Authoring
avm versionTest surfaces
| Surface | Command | Purpose |
| Terraform validation | avm test | Run Terraform initialization when needed and validate the module. |
| Unit tests | avm test unit | Run tests/unit/*.tftest.hcl with mocked providers. |
| Integration tests | avm test integration | Run tests/integration/*.tftest.hcl against real Azure. |
| E2E examples | avm test e2e | Apply, idempotency-check, and destroy runnable examples/*. |
| Policy | avm check policy | Build example plan JSON and evaluate APRL and AVMSEC through Conftest. |
| Full PR gate | avm pr-check | Run the clean-worktree PR gauntlet; it does not replace standalone test tiers. |
Always name the tier when tests are expected. Bare avm test validates Terraform; it does not run unit, integration, and E2E suites.
For Conftest findings or files under examples/<name>/exceptions, read avm-tf-conftest before changing Rego or suppressing a policy.
Unit tests
Place tests in tests/unit. Mock every provider declared by the module:
Every new resource-deploying module therefore mocks azapi. Declare or mock azurerm only when a test configures or exercises independently justified azurerm_* exception blocks.
mock_provider "azapi" {}
mock_provider "modtm" {}
mock_provider "random" {}
run "creates_the_resource" {
command = apply
variables {
name = "example"
parent_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example"
}
assert {
condition = output.resource_id != null
error_message = "The module should return the primary resource ID."
}
}Use mocked apply so computed values and resource creation paths can be asserted without Azure. Add focused tests for:
- defaults and optional features;
- validation failures with
expect_failures; - conditional resources;
- outputs;
- parent-to-submodule propagation; and
resource_types,retry,timeouts, andignore_body_changeswiring.
For detailed .tftest.hcl syntax, mocking, assertions, and troubleshooting patterns, see the Terraform test reference.
Integration tests
Place real-Azure Terraform tests in tests/integration. Do not mock providers. Keep each run focused, use unique names, and verify behaviors that cannot be proven from a mocked plan.
Test configurations, fixtures, and setup or teardown Terraform use AzAPI for every control-plane and ordinary supporting resource. If test scaffolding needs a direct Azure dependency that the module under test does not create, use an AzAPI resource, data source, or action and include Azure/azapi in that Terraform root's required_providers.
AzureRM may be configured or exercised only when required by permitted azurerm_* resource or data-source blocks. Each block must independently implement one specific unsupported data-plane/non-ARM operation, document the exact block and why no applicable AzAPI resource or action can implement it, link the upstream AzAPI issue or pull request, and be replaced when support ships. One valid block does not authorize another.
Authenticate without committed secrets. Local runs can use an authenticated Azure CLI session or supported ARM_* environment variables. CI uses OIDC with least-privilege identities and protected environments.
E2E examples
Each direct child of examples/ is a standalone Terraform root. Discover and target examples with:
avm test e2e --list
avm test e2e --example defaultWithout --example, runnable examples execute sequentially. A .e2eignore marker excludes an example from discovery. E2E performs:
- Terraform initialization;
- deployment;
- a no-change idempotency plan;
- cleanup; and
- bounded retries for recognized capacity failures.
An idempotency diff is a failure and is never hidden by a retry.
Every runnable example and E2E configuration uses AzAPI for direct Azure setup and control-plane resources, and its required_providers includes Azure/azapi. It may include AzureRM only to configure or exercise independently justified unsupported data-plane/non-ARM blocks. A legacy /azurerm suffix in a published AVM module source is a Registry namespace and is not an AzureRM provider declaration.
For exceptional manual workflows such as distributing examples across subscriptions or retaining deployments for inspection, see the manual example-testing reference.
PowerShell hooks
Supported hooks run in isolated pwsh processes:
tests/unit/setup.ps1;tests/integration/setup.ps1;examples/<name>/pre.ps1;examples/<name>/post.ps1; andexamples/<name>/tflint-pre.ps1.
Shell equivalents such as setup.sh, pre.sh, post.sh, or tflint-pre.sh are rejected as configuration errors. Port all hooks to PowerShell.
Use hooks only for required environment preparation or cleanup. Keep Terraform assertions in Terraform tests.
Authoring gates
Before committing:
avm pre-commitFor Terraform this applies sync, fixable convention rules, transforms, formatting, and docs. It is not a substitute for unit or real-Azure tests.
After reviewing and committing all changes:
avm pr-checkThe worktree must be clean. PR check runs sync, format, transform, lint, policy, convention, validation, and docs. Unit tests are deliberately a separate reusable-workflow job rather than repeated inside PR check.
CI expectations
- Use the governance-managed reusable Terraform workflow.
- Use OIDC and a user-assigned identity or equivalent secretless federation.
- Keep test environments least privilege and isolate subscriptions where practical.
- Treat
skippedas different frompass. If the change requires a test tier, an undiscovered or skipped tier is not evidence. - Preserve logs for failed Terraform run blocks, plans, policy findings, and cleanup failures.
Debugging
Run the smallest command that reproduces the issue:
avm test unit
avm test integration
avm test e2e --example default
avm lint
avm check policyUse -Path <module-directory> when testing a module outside the current directory and -Ecosystem terraform when context detection is ambiguous. Use --passthru for structured results in automation. Command failures throw; do not rely on $LASTEXITCODE or parse friendly console output.
When direct Terraform debugging is necessary, keep its flags consistent with the authoring engine and return to the avm command for final validation.
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.

