From e7a57fd0fdf46f7f867be175200371829035b7d7 Mon Sep 17 00:00:00 2001 From: Ashley Grant Date: Tue, 4 Aug 2026 21:48:12 -0600 Subject: [PATCH] Enhance Terraform Azure instructions with new guidelines (#2506) Added guidelines for provider selection and documentation updates from `generate-modern-terraform-code-for-azure.instructions.md`. --- instructions/terraform-azure.instructions.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/instructions/terraform-azure.instructions.md b/instructions/terraform-azure.instructions.md index f514b8e2..358d63bd 100644 --- a/instructions/terraform-azure.instructions.md +++ b/instructions/terraform-azure.instructions.md @@ -169,6 +169,10 @@ locals { - **Versioning**: Target latest stable Terraform and Azure provider versions. Specify versions in code and keep updated (TFFR3). +- **Provider selection (AzureRM vs AzAPI)**: Use the `azurerm` provider for most scenarios; it is stable and covers the majority of Azure services. Use the `azapi` provider only when you need the very latest Azure features or a resource not yet supported in `azurerm`. Document the choice in code comments, and prefer `azurerm` when in doubt. + +- **Minimal provider dependencies**: Do not introduce additional providers (e.g., `random`, `tls`) or external modules beyond the project's scope without user confirmation. Where one is required, add a comment explaining why and keep the stack lean. + ## 10. Folder Structure Use a consistent folder structure for Terraform configurations. @@ -194,7 +198,6 @@ my-azure-app/ │ ├── test.tfvars # Test environment │ └── prod.tfvars # Production environment ├── .github/workflows/ # CI/CD pipelines (if using github) -├── .azdo/ # CI/CD pipelines (suggested if using Azure DevOps) └── README.md # Documentation ``` @@ -229,6 +232,12 @@ Follow AVM specifications TFNFR1, TFNFR2, TFNFR3, and TFNFR4 for consistent file - Enable diagnostic settings for audit trails - Follow principle of least privilege +## Documentation + +- Keep documentation up to date. Update `README.md` with any new variables, outputs, or usage instructions whenever the code changes. +- Consider automating reference documentation with a tool such as `terraform-docs`. +- Update architecture diagrams to reflect infrastructure changes after each significant update. + ## Cost Management - Confirm budget approval for expensive resources