--- name: azure-iac-patterns description: >- Terraform patterns for Azure products that validate against one pinned version of the hashicorp/azurerm provider: virtual networks, managed identities, Container Apps, PostgreSQL, Storage, Key Vault and Monitor. Use when writing Terraform for an Azure product, before writing the resource. metadata: scope: deployment guidance provider: hashicorp/azurerm 4.40.0 --- # Azure IaC patterns Every pattern here passes `terraform validate` against `hashicorp/azurerm 4.40.0`. A test runs that on each of them, so an argument you copy from a pattern is in the right block. ## How to use them 1. Write `assets/versions.tf` to your working copy as `terraform/versions.tf`, unchanged. It pins the provider version these patterns and the `terraform_schema` tool describe. Declare the `subscription_id`, `location` and `resource_group_name` variables in `terraform/variables.tf`. 2. For each Element in the Target architecture, read the reference for its product with `load_skill_resource` and start from its pattern. Read only the references for products the Target architecture uses. 3. Change the pattern to meet the Element's Checks. For a setting the pattern does not show, call `terraform_schema` with `find` set to its name before you write it. | Product | Reference | | --- | --- | | Virtual network | `references/networking.md` | | Managed identity and role assignment | `references/identity.md` | | Container Apps | `references/container-apps.md` | | PostgreSQL Flexible Server | `references/postgresql.md` | | Storage account | `references/storage.md` | | Key Vault | `references/key-vault.md` | | Azure Monitor alert | `references/monitoring.md` | For a product with no reference, use `terraform_schema` to find its resource type and arguments. Never write an argument you haven't confirmed.