Add support for AVM pattern modules in Azure Terraform tools#2946
Open
liuwuliuyun wants to merge 3 commits into
Open
Add support for AVM pattern modules in Azure Terraform tools#2946liuwuliuyun wants to merge 3 commits into
liuwuliuyun wants to merge 3 commits into
Conversation
- Updated documentation to include pattern modules in CLI commands and examples. - Enhanced command descriptions to clarify support for both resource and pattern modules. - Modified data models and services to handle pattern modules, including parsing and fetching. - Added tests for pattern module functionality and ensured proper handling in existing tests.
Add 'aiml' and 'feff' to the cspell dictionary (used by AVM pattern module examples and the BOM-stripping escape) and remove a comment from the AvmModule model to satisfy the no-comments-in-implementation rule.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds AVM pattern module (avm-ptn-*) discovery to the Azure Terraform AVM tools by fetching and merging the pattern-module CSV alongside the existing resource-module CSV, and exposing the module kind via a new moduleType field.
Changes:
- Fetch
TerraformResourceModules.csvandTerraformPatternModules.csvin parallel, merge, and cache the combined module collection. - Add
ModuleTypetoAvmModuleand stamp parsed modules as"resource"or"pattern"(including BOM stripping for the pattern CSV header). - Update tests, command descriptions, docs/examples, spelling dictionary, and add a changelog entry.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.AzureTerraform/src/Services/AvmDocsService.cs | Fetch pattern-module CSV in parallel with resource-module CSV, merge results, stamp moduleType, strip BOM in header parsing. |
| tools/Azure.Mcp.Tools.AzureTerraform/src/Models/AvmModule.cs | Add ModuleType field surfaced in responses. |
| tools/Azure.Mcp.Tools.AzureTerraform/tests/Azure.Mcp.Tools.AzureTerraform.Tests/AvmDocsServiceParsingTests.cs | Add coverage for module typing and BOM header stripping. |
| tools/Azure.Mcp.Tools.AzureTerraform/tests/Azure.Mcp.Tools.AzureTerraform.Tests/AvmModuleListCommandTests.cs | Validate response includes both resource and pattern module types. |
| tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/AvmModuleListCommand.cs | Update tool description to mention pattern modules and moduleType. |
| tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/AvmVersionListCommand.cs | Update tool description to mention pattern modules. |
| tools/Azure.Mcp.Tools.AzureTerraform/src/Commands/AvmDocumentationGetCommand.cs | Update tool description to mention pattern modules. |
| tools/Azure.Mcp.Tools.AzureTerraform/src/AzureTerraformSetup.cs | Update AVM group description to mention pattern modules. |
| servers/Azure.Mcp.Server/README.md | Add example prompt for pattern-module docs. |
| servers/Azure.Mcp.Server/docs/e2eTestPrompts.md | Add e2e prompts covering pattern module list/versions/get. |
| servers/Azure.Mcp.Server/docs/azmcp-commands.md | Clarify avm list returns both resource and pattern modules. |
| servers/Azure.Mcp.Server/changelog-entries/avm-pattern-modules.yaml | Changelog entry for new pattern-module support. |
| .vscode/cspell.json | Add words used by new tests/implementation (aiml, feff). |
Comment on lines
+115
to
+121
| var resourceTask = FetchModulesAsync(client, ResourceModulesUrl, ModuleTypeResource, cancellationToken); | ||
| var patternTask = FetchModulesAsync(client, PatternModulesUrl, ModuleTypePattern, cancellationToken); | ||
| await Task.WhenAll(resourceTask, patternTask).ConfigureAwait(false); | ||
|
|
||
| var csvContent = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); | ||
| var modules = ParseModuleCsv(csvContent); | ||
| var modules = new List<AvmModule>(resourceTask.Result.Count + patternTask.Result.Count); | ||
| modules.AddRange(resourceTask.Result); | ||
| modules.AddRange(patternTask.Result); |
Comment on lines
+135
to
+139
| var response = await client.GetAsync(new Uri(url), cancellationToken).ConfigureAwait(false); | ||
| response.EnsureSuccessStatusCode(); | ||
|
|
||
| var csvContent = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); | ||
| return ParseModuleCsv(csvContent, moduleType); |
alzimmermsft
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds support for AVM pattern modules (
avm-ptn-*) to the Azure Terraformavmtools. Previously these tools only surfaced resource modules (avm-res-*) fromTerraformResourceModules.csv. The service now also fetchesTerraformPatternModules.csv(identical schema) and merges both into one collection.azureterraform avm listreturns both resource and pattern modules, each tagged with a newmoduleTypefield ("resource"or"pattern").azureterraform avm versionsandazureterraform avm getwork unchanged for pattern modules, since they already resolve a module by name from the merged collection and derive GitHub URLs from each module'sRepoUrl.No new commands or options — pattern modules are discoverable through the existing tools.
Implementation notes for reviewers:
Task.WhenAll) and cached together under the existing 24h cache.ParseModuleCsvgained amoduleTypeparameter to stamp each module; the pattern CSV has a leading BOM on its header, which is now stripped.avm listreturns 141 modules (112 resource + 29 pattern, correctly tagged);versions/getconfirmed working for theavm-ptn-aca-lza-hosting-environmentpattern module; resource modules unaffected (regression checked).Documentation: Azure Verified Modules (Terraform) · Pattern module index
GitHub issue number?
N/A — no linked issue.
Pre-merge Checklist
servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationREADME.mdchanges running the script./eng/scripts/Process-PackageReadMe.ps1. See Package READMEToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.jsonbreaking-changelabelservers/Azure.Mcp.Server/docs/azmcp-commands.md./eng/scripts/Update-AzCommandsMetadata.ps1to update tool metadata inazmcp-commands.md(required for CI)servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline