Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/chatmodes/aztf-agent.chatmode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
description: AI-powered agent for implementing Azure Terraform modules.
tools: ['changes', 'codebase', 'editFiles', 'extensions', 'fetch', 'findTestFiles', 'githubRepo', 'new', 'openSimpleBrowser', 'problems', 'runCommands', 'runTasks', 'runTests', 'search', 'searchResults', 'terminalLastCommand', 'terminalSelection', 'testFailure', 'usages', 'vscodeAPI', 'Terraform MCP Server', 'azmcp-bestpractices-get', 'pylance mcp server', 'azure-mcp-server-ext']
---
96 changes: 75 additions & 21 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,75 @@
## When writing or updating Terraform code
Use the instructions [here](./github/instructions/devbox-tf.instructions.md) for writing/updating Terraform code.

## When updating code
Document the changes made in the [CHANGELOG.md](CHANGELOG.md) file, including:
- A brief description of the change.
- If it is a bug fix, feature, or improvement.
- Include assessment if this is a breaking change or not.
## MCP Server Instructions
If the respective MCP server exists, follow these instructions:
- Terraform MCP Server: provides seamless integration with Terraform Registry APIs, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.
- Azure MCP Server: implements the MCP specification to create a seamless connection between AI agents and key Azure services like Azure Dev Center, Azure Dev Box, Azure Storage, Cosmos DB, and more.

## Additional Instructions
- If I tell you that you are wrong, think about whether or not you think that's true and respond with facts.
- Avoid apologizing or making conciliatory statements.
- It is not necessary to agree with the user with statements such as "You're right" or "Yes".
- Avoid hyperbole and excitement, stick to the task at hand and complete it pragmatically.
- Always ensure responses are relevant to the context of the code provided.
- Avoid unnecessary detail and keep responses concise.
- Revalidate before responding. Think step by step.
# DevFactory Project - General Development Guidelines

## Project Overview

DevFactory is a **modular Infrastructure as Code (IaC) project** for streamlining Azure development environment setup with consistent patterns and best practices.

## **CORE RULES**

### Reference Specific File Type Instructions
Check the files in `/.github/instructions/*.instructions.md` for any additional instructions based on the file you are working on. Check each file in this folder and check `applyTo: '**/*.<extension>` to see which files the instructions apply to. For example:
- If `tf.instructions.md` exists and it contains`applyTo: '**/*.tf'`, then follow instructions for creating/editing Terraform `.tf` files.
- If `md.instructions.md` exists and it contains `applyTo: '**/*.md'`, then follow instructions for creating/editing Markdown `.md` files.
- and so on...

**REMINDER**: If you are creating a new file, follow the above instructions as you create this file. If you didn't, review the file and modify it to follow the instructions in the relevant `.instructions.md` file.


### File and Folder Structure
- When you are creating new files or folders, follow the standards in #file:../docs/file_structure.md
- If you need a reference for what each file or folder does, refer to #file:../docs/file_structure.md
- When you create a new file in the `/` root folder or the `docs/` folder, update #file:../docs/file_structure.md with a brief decription of the file's purpose and any relevant details.
- When you create a new folder, update #file:../docs/file_structure.md with a brief description of the folder's purpose and any relevant details.

### **ALWAYS** Document Changes
**ALL CODE CHANGES** must be documented in #file:../CHANGES_SUMMARY.md including:
- Brief description of the change
- Classification: bug fix, feature, or improvement
- **Breaking change assessment** (YES/NO with justification)

### **ALWAYS** Follow Modular Patterns
- Consistent file structure across all modules
- Proper input validation and testing

## Communication Standards

**BE DIRECT AND PRAGMATIC**:
- Provide factual, actionable guidance
- Avoid hyperbole and excitement - stick to technical facts
- Think step-by-step and revalidate before responding
- Ensure responses are relevant to the codebase context

**AVOID**:
- Unnecessary apologizing or conciliatory statements
- Agreeing with users without factual basis ("You're right", "Yes")
- Verbose explanations when concise answers suffice

## CLI Standards

- When running commands, always do so from the root of the project directory. For example, if you are running `terraform init`, run it from the root of the project directory, not from within a module or subdirectory.
- When running commands, be mindful of the operating system as the paths and environment variables may differ. Use relative paths when possible.

## MCP Server Integration

**IF AVAILABLE**, use these Model Context Protocol servers:

- **Terraform MCP Server**: Seamless integration with Terraform Registry APIs for IaC automation
- **Azure MCP Server**: Connection to Azure services (Dev Center, Dev Box, Storage, Cosmos DB, etc.)

## Quality Standards

### **NEVER** Commit Without:
- Running validation tools (formatting, linting, testing)
- Testing examples to ensure they work
- Updating relevant documentation
- Documenting changes in #file:../CHANGES_SUMMARY.md

### **ALWAYS** Ensure:
- Changes follow established project patterns
- New features include complete working examples
- Security considerations (no hardcoded credentials)
- Backward compatibility or proper breaking change documentation

---

**Project Goal**: Build a foundation for modern Azure development environments with high standards of quality, security, and maintainability.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Devfactory Project - Terraform Implementation Guidelines
---
applyTo: '**/*.tf'
---

# DevFactory Project - Terraform Implementation Guidelines

## Quick Reference Summary

- **Provider:** AzAPI v2.4.0 only
- **Provider:** AzAPI v2.4.0 only. DO NOT use `azurerm`.
- **Run Location:** Always from project root
- **Sensitive Data:** Never hardcode credentials or subscription IDs
- **Module Verification:** Always check resource arguments against latest provider docs
Expand All @@ -13,7 +17,8 @@
---

## DO
- Use only AzAPI provider version 2.4.0
- Use only AzAPI provider version 2.4.0.
- Use `eastus` as the default Azure region, unless otherwise specified.
- Place all resource modules in `/modules/` and examples in `/examples/`
- Use dynamic blocks for optional/flexible config
- Use nested maps and strongly-typed objects for variables
Expand All @@ -32,14 +37,8 @@
- Do not use untyped or weakly-typed variables
- Do not skip example creation for new/changed resources
- Do not commit without running `terraform fmt` and `terraform validate`
- Do not use provider versions other than 2.4.0

---

## Repository Structure
- `/modules/`: Resource-specific modules (storage, networking, compute, etc.)
- `/examples/`: Example implementations/configurations for each module
- `/docs/`: Project documentation and conventions
- Do not use AzAPI provider versions other than 2.4.0.
- DO not use the azurerm provider.

---

Expand Down Expand Up @@ -176,6 +175,8 @@ resource "azurerm_key_vault" "kv" {
}
```

**NOTE:** `azurerm_*` is just the resource naming convention. **DO NOT** use the `azurerm` provider. Use the `azapi` provider instead.

---

## Example Patterns
Expand Down
43 changes: 43 additions & 0 deletions .github/prompts/1-plan.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
description: 'Plan an implementation'
---

Your goal is to generate an implementation plan, in a new markdown .md file, for the terraform module provided to you. Create this file in `/docs/plans/<module_name>.plan.md`.

## RULES:
- Keep implementations simple, do not over architect
- Do not generate real code for your plan, pseudocode is OK
- For each step in your plan, include the objective of the step, the steps to achieve that objective, and any necessary pseudocode.
- Call out any necessary user intervention required for each step
- Consider accessibility part of each step and not a separate step

## Steps to Follow
### 1. FIRST
- Review the attached specification document to understand the requirements and objectives.
- If needed, refer to https://registry.terraform.io/providers/Azure/azapi/2.4.0/docs/resources/<resource> using the #fetch tool (use AzAPI v2.4.0 only).

### 2. THEN
- Create a detailed implementation plan that outlines the steps needed to achieve the objectives of the specification document.
- Think about the file types that will be created, and review the file `/docs/file_structure.md` as well as instructions for the relevant file in the `/.github/instructions/` folder. For example, follow the instructions in `/.github/instructions/tf.instructions.md` for `*.tf` files.
- The plan should be structured, clear, and easy to follow.
- Always add validation steps in your plan to ensure the implementation meets the requirements.
- Structure your plan as follows, and output as Markdown code block

```markdown
# Implementation Plan for [Spec Name]

- [ ] Step 1: [Brief title]
- **Task**: [Detailed explanation of what needs to be implemented]
- **Files**: [Maximum of 20 files, ideally less]
- `path/to/file1.tf`: [Description of changes], [Pseudocode for implementation]
- **Dependencies**: [Dependencies for step]

[Additional steps...]
```

### 3. NEXT:
- Validate and self-review your plan to ensure it meets the requirements and is ready for implementation.
- Iterate with me until I am satisifed with the plan

### 4. FINALLY:
- DO NOT start implementation without my permission.
16 changes: 16 additions & 0 deletions .github/prompts/2-implement.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
description: 'Implement a plan step by step'
---
Your task is to implement each step of the provided plan, one at a time.
- The plan is just a suggestion to guide you in the right direction.
- You do not have to strictly follow it if it does not make sense.
- ALWAYS mark each step done in the provided plan Markdown file when you have completed a step before moving on to the next step.

Before implementation, check the corresponding instructions in the `~/.github/instructions` folder.
For example, follow the instructions in `~/.github/instructions/tf.instructions.md` for `*.tf` files.

Refer to [file_structure.md](../../docs/file_structure.md) and check other implementations in the workspace to see how they are done. **DO NOT** make changes to the other files that you are only using for reference.

Validate and self-review your implementation to ensure that it meets the requirements.

Iterate with me until I am satisfied with the implementation.
37 changes: 37 additions & 0 deletions .github/prompts/3-apply.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
description: 'Test the Terraform module implementation by running `terraform plan` and `terraform apply`'
---
Your task is to run `terraform plan` and then `terraform apply` on the `configuration.tfvars` of the terraform module provided to you. And then fix any issues that arise during the process. You will be working with the Terraform module located in `~/modules/<module_name>`.

Fix issues as they arise during the process, and ensure that the module is applied correctly.
Refer to the following to better understand the implementation done before fixing:
- The `~/modules/<module_name>/README.md` file for usage instructions.
- The `~/CHANGES_SUMMARY.md` file for recent changes and updates.
- The `~/docs/plans/<module_name>.plan.md` file for the implementation plan

## Steps to Follow
### 1. PREPARATION
- Ensure that the CLI is authenticated with `az login`. If not, run `az login` so that I can authenticate and select my desired Azure subscription.
- Ensure `ARM_SUBSCRIPTION_ID` environment variable is set to the selected Azure subscription ID.
- Run `terraform init` on the workspace root folder to initialize the Terraform environment.

### 2. CONFIGURATION
- Look for the example `configuration.tfvars` of the terraform module to be applied. This file should be in the `/examples/<module_name>/simple_case` folder.
- ONLY look for the `simple_case` example unless otherwise specified.
- Check the Azure region specified in the `configuration.tfvars` file and confirm this with me. Change the region if I specify a different one.

### 3. TERRAFORM PLAN (MANDATORY STEP - DO NOT SKIP)
- **REQUIRED**: Run `terraform plan -var-file=examples/<module_name>/simple_case/configuration.tfvars` to see the planned changes.
- Review the plan output carefully
- Fix any issues that arise during the plan step
- Confirm that the plan shows the expected resources to be created/modified
- **ONLY proceed to step 4 after a successful plan with no errors**

### 4. TERRAFORM APPLY (ONLY AFTER SUCCESSFUL PLAN)
- **Prerequisites**: Step 3 (terraform plan) must be completed successfully with no errors
- Run `terraform apply -auto-approve -var-file=examples/<module_name>/simple_case/configuration.tfvars` to apply the changes
- Monitor the apply process for any issues
- **REMINDER**: This step should ONLY be executed after a successful terraform plan

### 5. POST-APPLY CHECKS
- Ask me to confirm that the resources have been created successfully by checking the Azure portal.
Loading