agentleFS
jonathan-vellajonathan-vella/bmit-2026/.github/skills/terraform-patterns/SKILL.md

terraform-patterns

Skill3 starsChanged 8 months agoMITArchived repositoryView on GitHub

Reusable Azure Terraform patterns: hub-spoke, private endpoints, diagnostics, AVM-TF modules. USE FOR: Terraform template design, hub-spoke networking, AVM modules, plan interpretation. DO NOT USE FOR: Bicep code, architecture decisions, troubleshooting, diagram generation.

6 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

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    AVM-first: Use Azure/avm-res-* registry modules over raw azurerm_* resources

    line 60
  2. Distinctive:

    Diagnostics: Every resource MUST have a diagnostic setting → Log Analytics

    line 63
  3. Very specific:

    Conditional: Use for_each (keyed) over count (indexed) for named resources

    line 64
  4. Very specific:

    Moved blocks: Use moved {} when renaming resources to prevent destroy/recreate

    line 68

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “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

Azure Terraform Patterns Skill

Composable architecture building blocks for Azure Terraform. Complements iac-terraform-best-practices.instructions.md (style) and azure-defaults skill (naming, tags, regions).


Quick Reference

PatternWhen to UseReference
Hub-Spoke NetworkingMulti-workload environments with shared servicesreferences/hub-spoke-pattern.md
Private Endpoint WiringAny PaaS service requiring private connectivityreferences/private-endpoint-pattern.md
Diagnostic SettingsEvery deployed resource (mandatory)references/common-patterns.md
Conditional DeploymentOptional resources controlled by variablesreferences/common-patterns.md
Module CompositionCalling multiple AVM modules in root moduleSee inline example below
Managed IdentityAny service-to-service authenticationreferences/common-patterns.md
Budget & Cost MonitoringEvery deployment (mandatory)references/budget-pattern.md
Plan InterpretationPre-deployment validation and change analysisreferences/plan-interpretation.md
AVM PitfallsSet-type diffs, provider pins, 4.x changesreferences/avm-pitfalls.md
AVM AuthoringAVM certification requirements, compliancereferences/avm-authoring-requirements.md
Module RefactoringMonolith → module extraction, state migrationreferences/refactor-module.md

Canonical Example — Module Composition

Wire AVM child modules by passing outputs as inputs; never hardcode IDs:

module "resource_group" {
  source  = "Azure/avm-res-resources-resourcegroup/azurerm"
  version = "~> 0.1"
  name     = "rg-${var.project}-${var.environment}"
  location = var.location
  tags     = local.tags
}

module "key_vault" {
  source  = "Azure/avm-res-keyvault-vault/azurerm"
  version = "~> 0.9"
  name                = local.kv_name
  resource_group_name = module.resource_group.name  # ← output wiring
  location            = var.location
  tenant_id           = data.azurerm_client_config.current.tenant_id
  tags                = local.tags
}

Key Rules

  • AVM-first: Use Azure/avm-res-* registry modules over raw azurerm_* resources
  • Hub-spoke: Spokes peer to hub only; never spoke-to-spoke
  • Private endpoints: Three resources per service — PE, DNS zone, VNet link
  • Diagnostics: Every resource MUST have a diagnostic setting → Log Analytics
  • Conditional: Use for_each (keyed) over count (indexed) for named resources
  • Identity: SystemAssigned managed identity + RBAC; avoid keys/connection strings
  • Provider pin: ~> 4.0 (allows 4.x patches, blocks 5.0)
  • Telemetry: Set enable_telemetry = false in restricted-network environments
  • Moved blocks: Use moved {} when renaming resources to prevent destroy/recreate
  • Budget: 3 forecast thresholds (80%/100%/120%); amount and emails MUST be variables

Reference Index

FileContents
references/hub-spoke-pattern.mdFull hub & spoke VNet + peering HCL
references/private-endpoint-pattern.mdPE + DNS zone + VNet link HCL, subresource table
references/common-patterns.mdDiagnostics, conditional deployment, module composition, identity
references/budget-pattern.mdConsumption budget, forecast alerts, anomaly detection
references/plan-interpretation.mdPlan commands, change symbols, red flags, summary script
references/avm-pitfalls.mdSet-type diffs, provider pins, tag ignore, moved blocks, 4.x
references/tf-best-practices-examples.mdBest-practice code examples, formatting, code review checklist
references/bootstrap-backend-template.mdBackend bootstrap template
references/deploy-script-template.mdDeployment script template
references/project-scaffold.mdProject scaffolding structure
references/avm-authoring-requirements.mdAVM certification: 37 requirements, compliance checklist
references/refactor-module.mdModule extraction, state migration, refactoring patterns

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.