alpha

Sets rules for a coding assistant creating or changing Terraform on Azure, covering DevOps principles, code structure, security and safe use of terraform commands.
description: 'Create or modify solutions built using Terraform on Azure.'
applyTo: '**/.terraform, **/.tf, **/.tfvars, **/.tflint.hcl, **/.tfstate, **/.tf.json, **/*.tfvars.json'
This instruction set extends the universal DevOps Core Principles and Taming Copilot directives for Azure/Terraform scenarios. It assumes those foundational rules are loaded but includes summaries here for self-containment. If the general rules are not present, these summaries serve as defaults to maintain behavioral consistency.
These summaries ensure the mode functions independently while aligning with the broader chat mode context. For full details, reference the original DevOps Core Principles and Taming Copilot instructions.
When operating in chat mode with these instructions loaded:
.terraform-planning-files/ folder (if present). Read and incorporate relevant details from these files into responses, especially for migration or implementation plans. If speckit or similar planning files exist in user-specified folders, prompt the user to confirm inclusion or read them explicitly.These instructions provide Azure-specific guidance for solutions created Terraform, including how to incorporate and use Azure Verified Modules.
For general Terraform conventions, see [terraform.instructions.md](terraform.instructions.md).
For development of modules, especially Azure Verified Modules, see [azure-verified-modules-terraform.instructions.md](azure-verified-modules-terraform.instructions.md).
Configuration:
terraform import as a regular workflow patternlocal-exec provisioners unless absolutely necessarySecurity:
Operational:
**/*.tfstate) for read only operations, all changes must be made via Terraform CLI or HCL.**/.terraform/** (fetched modules and providers) for read only operations.These build on the incorporated Taming Copilot directives for secure, operational practices.
Structure Terraform configurations with logical file separation:
main.tf for resourcesvariables.tf for inputsoutputs.tf for outputsterraform.tf for provider configurationslocals.tf to abstract complex expressions and for better readabilityterraform fmt)main.networking.tf, main.storage.tf - move equivalent variables to variables.networking.tf, etc.)Use snake_casing for variables and module names.
Any significant resource should use an AVM if available. AVMs are designed to be aligned to the Well Architected Framework, are supported and maintained by Microsoft helping reduce the amount of code to be maintained. Information about how to discover these is available in [Azure Verified Modules for Terraform](azure-verified-modules-terraform.instructions.md).
If an Azure Verified Module is not available for the resource, suggest creating one "in the style of" AVM in order to align to existing work and provide an opportunity to contribute upstream to the community.
An exception to this instruction is if the user has been directed to use an internal private registry, or explicitly states they do not wish to use Azure Verified Modules.
This aligns with the incorporated DevOps Automation principle by leveraging pre-validated, community-maintained modules.
Follow AVM-aligned coding standards in solution code to maintain consistency:
sensitive = false explicitly (per TFNFR22). Handle sensitive default values correctly (per TFNFR23).coalesce or try functions for default values (per TFNFR13).locals.tf specifically for local values (per TFNFR31) and ensure precise typing for locals (per TFNFR33).The best secret is one that does not need to be stored. e.g. use Managed Identities rather than passwords or keys.
Use ephemeral secrets with write-only parameters when supported (Terraform v1.11+) to avoid storing secrets in state files. Consult module documentation for availability.
Where secrets are required, store in Key Vault unless directed to use a different service.
Never write secrets to local filesystems or commit to git.
Mark sensitive values appropriately, isolate them from other attributes, and avoid outputting sensitive data unless absolutely necessary. Follow TFNFR19, TFNFR22, and TFNFR23.
sensitive = true for outputs containing secretsoutput "resource_group_name" {
description = "Name of the created resource group"
value = azurerm_resource_group.example.name
}
output "virtual_network_id" {
description = "ID of the virtual network"
value = azurerm_virtual_network.example.id
}
locals {
common_tags = {
Environment = var.environment
Project = var.project_name
Owner = var.owner
CreatedBy = "terraform"
}
resource_name_prefix = "${var.project_name}-${var.environment}"
location_short = substr(var.location, 0, 3)
}
Redundant depends_on Detection: Search and remove depends_on where the dependent resource is already referenced implicitly in the same resource block. Retain depends_on only where it is explicitly required. Never depend on module outputs.
Iteration: Use count for 0-1 resources, for_each for multiple resources. Prefer maps for stable resource addresses. Align with TFNFR7.
Data sources: Acceptable in root modules but avoid in reusable modules. Prefer explicit module parameters over data source lookups.
Parameterization: Use strongly typed variables with explicit type declarations (TFNFR18), comprehensive descriptions (TFNFR17), and non-nullable defaults (TFNFR20). Leverage AVM-exposed variables.
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.
Use a consistent folder structure for Terraform configurations.
Use tfvars to modify environmental differences. In general, aim to keep environments similar whilst cost optimising for non-production environments.
Antipattern - branch per environment, repository per environment, folder per environment - or similar layouts that make it hard to test the root folder logic between environments.
Be aware of tools such as Terragrunt which may influence this design.
A suggested structure is:
my-azure-app/
├── infra/ # Terraform root module (AZD compatible)
│ ├── main.tf # Core resources
│ ├── variables.tf # Input variables
│ ├── outputs.tf # Outputs
│ ├── terraform.tf # Provider configuration
│ ├── locals.tf # Local values
│ └── environments/ # Environment-specific configurations
│ ├── dev.tfvars # Development environment
│ ├── test.tfvars # Test environment
│ └── prod.tfvars # Production environment
├── .github/workflows/ # CI/CD pipelines (if using github)
└── README.md # Documentation
Never change the folder structure without direct agreement with the user.
Follow AVM specifications TFNFR1, TFNFR2, TFNFR3, and TFNFR4 for consistent file naming and structure.
README.md with any new variables, outputs, or usage instructions whenever the code changes.terraform-docs.terraform validate to check syntaxterraform plan. Terraform plan will require a subscription ID, this should be sourced from the ARM_SUBSCRIPTION_ID environment variable, NOT coded in the provider block.If general rules are not loaded, default to: minimalist code generation, explicit consent for any terraform commands beyond validate, and adherence to CALMS principles in all suggestions.
© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com


Lovart hero banner with floating GPT Image 2 mockups
Builds a futuristic AI product-launch hero banner from a JSON spec: a glowing app interface in the centre with floating posters, model menu and capability cards, all with exact text.
image-prompt, json-prompt, ui-mockup, text-rendering, structured-output, 3d-render, futuristic, neon, dramatic-lighting, widescreen, night-scene, bokeh, symmetry, mockup, social-media-graphic, poster, gpt-image, advertising, branding, luxury, cyberpunk, long-form, advanced, for-designers, for-marketers, product-photography, glassmorphism

Selfie vlog of a ramen bowl in kitchen
Generates a 15-second handheld selfie-vlog of a young woman enjoying a ramen bowl, with eight timed shots, short spoken lines and an authentic phone-footage look.
video-prompt, hailuo, ugc-video, vlog, multi-shot, timed-beats, lip-sync, handheld, product-video, food-photography, smartphone-photo, negative-prompt, reference-image, image-to-video, short-form-video, tiktok, japan, woman, selfie, pov, close-up, high-angle, natural-light, character-consistency, cozy, for-content-creators

Robed figure gazes at moonlit cloud palace
Animates a still of a robed figure facing a moonlit cloud palace with slow push-ins, drifting mist and swaying pines, with negative prompts that keep the figure still.
video-prompt, image-to-video, negative-prompt, camera-movement, cinematic, fantasy-world, dreamy, moody, natural-light, landscape, mountains, night-scene, blue-hour, silhouette, slow-motion, multi-shot, mythology, china, woman, hailuo, for-filmmakers, structured-output, guardrails
Loading reviews…
Loading comments…