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
Show all changes
18 commits
Select commit Hold shift + click to select a range
f2645b7
Update Copilot instructions to reflect AzAPI provider version 2.4.0
arnaudlh May 26, 2025
ebbb2f1
Refactor Azure Resource Group module to use AzAPI provider v2.4.0 and…
arnaudlh May 26, 2025
82916c0
Implement Azure DevCenter module updates for 2025-04-01-preview API, …
arnaudlh May 26, 2025
39bdc5d
Add mock data configuration for azapi provider in test files
arnaudlh May 26, 2025
a531be7
Enhance Dev Center Environment Type module: add display_name support,…
arnaudlh May 26, 2025
0750bea
Refactor Dev Center Project module to use AzAPI provider, enhance ide…
arnaudlh May 26, 2025
b721dea
Update README files for Azure DevCenter modules: enhance overview and…
arnaudlh May 26, 2025
2b186c5
Enhance README documentation for Azure modules: add requirements, pro…
arnaudlh May 26, 2025
686a1f8
Refactor Terraform tests and remove deprecated files
arnaudlh May 26, 2025
0836f0e
Add script description to trigger GitHub Actions
arnaudlh May 26, 2025
a524ab5
Update Terraform CI workflow: add test scripts, remove example tests,…
arnaudlh May 26, 2025
3810b28
Remove push trigger from Terraform CI workflow to streamline executio…
arnaudlh May 26, 2025
043b71d
Update CHANGES_SUMMARY.md
arnaudlh May 26, 2025
6c0ae03
feat: Add Dev Center Catalog functionality with GitHub and Azure DevO…
arnaudlh May 27, 2025
d7987f2
Merge branch 'azapi-update' of https://github.com/arnaudlh/devfactory…
arnaudlh May 27, 2025
a0de365
chore: Update Terraform version to 1.12.1 and remove azurerm mock pro…
arnaudlh May 30, 2025
c5fb16f
docs: Update README with Azure login and Terraform plan commands for …
arnaudlh May 30, 2025
040644a
fix: Add ref parameter to checkout steps in workflow files for consis…
arnaudlh May 30, 2025
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ghcr.io/azure/azure-dev/azd:latest": {},
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/terraform:1": {
"terraformVersion": "1.11.3",
"terraformVersion": "1.12.1",
"installTFsec": true,
"tflint": "0.53.0",
"installTerraformDocs": true
Expand Down
79 changes: 66 additions & 13 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Quick Reference Summary

- **Provider:** AzureRM v4.26 only
- **Provider:** AzAPI v2.4.0 only
- **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 +13,7 @@
---

## DO
- Use only AzureRM provider version 4.26
- Use only AzAPI provider version 2.4.0
- 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 @@ -24,14 +24,15 @@
- Add input validation in `variables.tf`
- Add a working example for every resource/module
- Update module README.md with usage and examples
- Reference provider docs for every resource: https://registry.terraform.io/providers/hashicorp/azurerm/4.26.0/docs/resources/<resource>
- Reference provider docs for every resource: https://registry.terraform.io/providers/Azure/azapi/2.4.0/docs/resources/<resource>
- Use the Azure MCP server to find the latest API version, detailed schema, and attributes for each resource implemented.

## DO NOT
- Do not embed subscription IDs or credentials in code/config
- 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 4.26
- Do not use provider versions other than 2.4.0

---

Expand Down Expand Up @@ -62,21 +63,23 @@

**Resource Creation:**
```hcl
resource "azurecaf_name" "name" {
resource "azurecaf_name" "this" {
name = var.name
resource_type = "azurerm_resource_type"
resource_type = "general"
prefixes = var.global_settings.prefixes
random_length = var.global_settings.random_length
clean_input = true
passthrough = var.global_settings.passthrough
use_slug = var.global_settings.use_slug
}

resource "azurerm_resource" "resource" {
name = azurecaf_name.name.result
location = var.location
resource_group_name = var.resource_group_name
tags = local.tags
resource "azapi_resource" "this" {
name = azurecaf_name.this.result
location = var.location
parent_id = var.parent_id
type = var.resource_type
api_version = var.api_version
tags = local.tags
# Resource-specific properties
}
```
Expand Down Expand Up @@ -221,6 +224,56 @@ resource "azurerm_key_vault" "kv" {

---

## Azure API Property Naming and Data Type Conventions

### DevCenter API Specifics (API Version 2025-04-01-preview)
When working with Azure DevCenter resources, be aware of these critical naming and data type requirements:

**Property Naming Convention:**
- Azure DevCenter API requires camelCase property names in the request body
- Terraform variables use snake_case for consistency
- Always map snake_case variable names to camelCase API properties

**Common Property Mappings:**
```hcl
# Variable (snake_case) → API Property (camelCase)
install_azure_monitor_agent_enable_installation → installAzureMonitorAgentEnableStatus
microsoft_hosted_network_enable_status → microsoftHostedNetworkEnableStatus
catalog_item_sync_enable_status → catalogItemSyncEnableStatus
```

**Data Type Requirements:**
- Many DevCenter "enable" properties expect string values, not booleans
- Use `"Enabled"` or `"Disabled"` instead of `true`/`false`
- Always verify expected data types in Azure API documentation

**Example Implementation:**
```hcl
# Variable definition (snake_case, string type)
variable "dev_box_provisioning_settings" {
type = object({
install_azure_monitor_agent_enable_installation = optional(string, "Enabled")
})
}

# API body mapping (camelCase)
body = {
properties = {
devBoxProvisioningSettings = {
installAzureMonitorAgentEnableStatus = try(var.settings.dev_box_provisioning_settings.install_azure_monitor_agent_enable_installation, "Enabled")
}
}
}
```

**Validation Approach:**
- Always run `terraform plan` to validate API compatibility
- Check Azure API documentation for exact property names and types
- Use Azure MCP server tools to verify latest API schemas
- Test with actual API calls when implementing new resource properties

---

## Security Best Practices
- Use `sensitive = true` for secret variables
- Never hardcode credentials
Expand All @@ -236,13 +289,13 @@ resource "azurerm_key_vault" "kv" {
- See `/examples/` for implementation
- See `docs/conventions.md` for standards
- See `docs/module_guide.md` for module development
- Always verify resource arguments at: https://registry.terraform.io/providers/hashicorp/azurerm/4.26.0/docs/resources/<resource>
- Always verify resource arguments at: https://registry.terraform.io/providers/Azure/azapi/2.4.0/docs/resources/<resource>

---

## AI Assistant Prompt Guidance
- When asked to generate Terraform code, always:
- Use AzureRM provider v4.26
- Use AzAPI provider v2.4.0
- Use strong typing and validation for variables
- Add an example in `/examples/`
- Reference provider documentation for all arguments
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/terraform-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup TFLint
uses: terraform-linters/setup-tflint@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/terraform-security-msdo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: microsoft/security-devops-action@v1.12.0
id: msdo
with:
Expand Down
62 changes: 38 additions & 24 deletions .github/workflows/terraform-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on:
- "**.tf"
- "**.tfvars"
- "**.tftest.hcl"
- "tests/run_test.sh"
- "tests/run_tests.sh"
- ".github/workflows/terraform-tests.yml"
workflow_dispatch:

permissions:
contents: read
Expand All @@ -16,9 +19,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.11.4
terraform_version: 1.12.1
- name: Terraform Init
run: terraform init -backend=false
- name: Terraform Format
Expand All @@ -31,9 +36,10 @@ jobs:
outputs:
unit_tests: ${{ steps.find-unit-tests.outputs.tests }}
integration_tests: ${{ steps.find-integration-tests.outputs.tests }}
example_tests: ${{ steps.find-example-tests.outputs.tests }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Find unit tests
id: find-unit-tests
run: |
Expand All @@ -44,11 +50,6 @@ jobs:
run: |
TESTS=$(find tests/integration -name "*_test.tftest.hcl" -type f | jq -R -s -c 'split("\n")[:-1]')
echo "tests=$TESTS" >> $GITHUB_OUTPUT
- name: Find example tests
id: find-example-tests
run: |
TESTS=$(find tests/examples -name "*_test.tftest.hcl" -type f | jq -R -s -c 'split("\n")[:-1]')
echo "tests=$TESTS" >> $GITHUB_OUTPUT

unit-tests:
needs: [pre-check, discover-tests]
Expand All @@ -59,13 +60,19 @@ jobs:
test: ${{fromJson(needs.discover-tests.outputs.unit_tests)}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.11.4
terraform_version: 1.12.1
- name: Terraform Init
run: terraform init -backend=false
- name: Run Test
run: terraform test -verbose "${{ matrix.test }}"
- name: Run Unit Test
run: |
TEST_DIR=$(dirname "${{ matrix.test }}")
cd $TEST_DIR
terraform init -input=false
terraform test -verbose $(basename "${{ matrix.test }}")

integration-tests:
needs: [pre-check, discover-tests]
Expand All @@ -76,27 +83,34 @@ jobs:
test: ${{fromJson(needs.discover-tests.outputs.integration_tests)}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.11.4
terraform_version: 1.12.1
- name: Terraform Init
run: terraform init -backend=false
- name: Run Test
run: terraform test -verbose "${{ matrix.test }}"
- name: Run Integration Test
run: |
TEST_DIR=$(dirname "${{ matrix.test }}")
cd $TEST_DIR
terraform init -input=false
terraform test -verbose $(basename "${{ matrix.test }}")

example-tests:
needs: [pre-check, discover-tests]
if: needs.discover-tests.outputs.example_tests != '[]'
comprehensive-tests:
needs: [unit-tests, integration-tests]
runs-on: ubuntu-latest
strategy:
matrix:
test: ${{fromJson(needs.discover-tests.outputs.example_tests)}}
if: always()
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.11.4
- name: Terraform Init
run: terraform init -backend=false
- name: Run Test
run: terraform test -verbose "${{ matrix.test }}"
terraform_version: 1.12.1
- name: Make test scripts executable
run: |
chmod +x tests/run_test.sh
chmod +x tests/run_tests.sh
- name: Run All Tests
run: ./tests/run_tests.sh
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
- id: terraform_docs
- id: terraform_tflint
- id: terraform_validate
- id: terraform_tfsec
- id: terraform_trivy
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand Down
16 changes: 16 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@
"group": {
"kind": "build"
}
},
{
"label": "Terraform: Run All Tests",
"type": "shell",
"command": "/bin/bash",
"args": [
"-c",
"./tests/run_tests.sh"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [],
"group": {
"kind": "test"
}
}
],
"inputs": [
Expand Down
Loading