agentleFS
Microsoft AzureKnown publisherAzure/azure-verified-modules-managed-files/terraform/root/.github/skills/avm-tf-conftest/SKILL.md

avm-tf-conftest

Skill1 starsChanged 2 months agoMITView on GitHub

Use whenever an AVM Terraform task involves Conftest, OPA, Rego, APRL, AVMSEC, policy findings, policy exceptions, or files under an example exceptions directory. Covers current policy identifiers, example-local exception placement, package names, and managed policy validation. Trigger on "conftest", "rego", "APRL", "AVMSEC", "policy failure", "policy exception", "deny_", and "avm check policy".

232 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

11 rules. About 0 are common, 6 are distinctive, and 5 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.

  • 5

    Very specific

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

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

    Use Conftest through Avm.Authoring.

    line 8
  2. Distinctive:

    Before diagnosing a finding or adding an exception:

    line 12
  3. Distinctive:

    Read the current AVM OPA and Conftest policy exception guidance.

    line 14
  4. Very specific:

    Read the current Azure/policy-library-avm documentation.

    line 15
  5. Distinctive:

    Check the planned values that caused the finding before deciding that the rule is inapplicable.

    line 17
  6. Distinctive:

    Do not copy an exception from another module without verifying the current rule source and the example's plan.

    line 19
  7. Very specific:

    If the version gate reports a stale installation, run avm update, re-import the module, and retry.

    line 35
  8. Distinctive:

    Place exception files in the failing example:

    line 39
  9. Very specific:

    Never use an empty rule identifier.

    line 54
  10. Very specific:

    Do not include the deny_ prefix in rules.

    line 71
  11. Distinctive:

    After adding or changing an exception:

    line 92

≈ “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.

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

AVM Terraform Conftest

Use Conftest through Avm.Authoring. Fix the planned configuration instead of adding an exception unless the policy genuinely does not apply to the example.

Read current sources first

Before diagnosing a finding or adding an exception:

  1. Read the current AVM OPA and Conftest policy exception guidance.
  2. Read the current Azure/policy-library-avm documentation.
  3. Locate the reported policy in Azure/policy-library-avm and confirm its package, exact deny_ identifier, provider implementation, and expected behavior.
  4. Check the planned values that caused the finding before deciding that the rule is inapplicable.

Do not copy an exception from another module without verifying the current rule source and the example's plan.

Run the managed policy check

Import-Module Avm.Authoring
avm version
avm check policy

avm check policy creates plans for examples and evaluates both Azure Proactive Resiliency Library (APRL) and AVM Security (AVMSEC) policies through Conftest. It requires Azure credentials for plan generation. The full clean-worktree gate also runs policy checks:

avm pr-check

If the version gate reports a stale installation, run avm update, re-import the module, and retry. Do not replace the managed command with a separately installed Conftest binary or a hand-built policy checkout.

Exception location and scope

Place exception files in the failing example:

examples/<example-name>/exceptions/<descriptive-name>.rego

An exception in this directory applies only while evaluating that example. Use a descriptive filename and keep different Rego packages in separate files.

Every exception must:

  • name only the policy identifiers that are genuinely inapplicable;
  • explain why the example cannot or should not comply;
  • link an issue or authoritative source when the exception is temporary or depends on an upstream limitation; and
  • remain narrower than excluding the example from policy or E2E validation.

Never use an empty rule identifier. Conftest treats it as an exception for unqualified deny or violation rules. Do not exclude an entire policy family merely to make the check pass.

APRL exceptions

APRL policies use the Azure_Proactive_Resiliency_Library_v2 package. The exception identifier is the suffix of the policy's deny_<identifier> rule:

package Azure_Proactive_Resiliency_Library_v2

import rego.v1

# The service does not support zones in the region used by this example.
exception contains rules if {
  rules = ["configure_aks_default_node_pool_zones"]
}

Do not include the deny_ prefix in rules.

AVMSEC exceptions

AVMSEC policies use the avmsec package. Findings and policy source identify rules with names such as deny_AVM_SEC_137; use the suffix without deny_:

package avmsec

import rego.v1

# AVM_SEC_137 does not apply for the documented reason tracked in <issue-url>.
exception contains rules if {
  rules = ["AVM_SEC_137"]
}

The policy library exposes severity collections such as rules_below_high and rules_below_medium. Do not use those broad collections for a normal module example exception; list exact policy identifiers so unrelated security checks remain active.

Validate the result

After adding or changing an exception:

  1. Run avm check policy.
  2. Confirm the intended finding is reported as an exception rather than silently disappearing.
  3. Confirm no unrelated APRL or AVMSEC findings were suppressed.
  4. Review whether the example can be changed to remove the exception.

Conftest reports exceptions separately from passes, warnings, and failures. Treat that exception count as review evidence, not as a clean-policy result.

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.