Simplify Bicep infrastructure: flat module library replacing framework pattern#61
Draft
therealjohn wants to merge 5 commits into
Draft
Simplify Bicep infrastructure: flat module library replacing framework pattern#61therealjohn wants to merge 5 commits into
therealjohn wants to merge 5 commits into
Conversation
- Remove storage.bicep and integrate storage logic into new modules. - Update main.bicep to streamline resource group and AI project creation. - Introduce new modules for ACR, AI project, AI search, and Bing grounding. - Enhance connection management with a dedicated connection module. - Adjust parameters and outputs for better clarity and usability.
… with hosted agent runtime
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.
Problem
The Bicep infra had become a generic framework with business logic — JSON array parameters parsed at deploy-time to dynamically decide which resources to create,
filter()/map()operations, deeply nested ternary outputs, dual codepaths for new vs. existing projects, and outputs for resource types the template doesn't use. ~2,877 lines across 14 files for a "basic starter."
Changes
Architecture: framework → flat module library
Replace the
core/directory tree (deeply nested, interdependent modules with a 414-line "God module") with a flatmodules/directory where each module is self-contained: creates its resource + Foundry Project connection + RBAC.infra/core/ai/ai-project.bicep(414 lines, creates everything conditionally)infra/modules/ai-project.bicep(216 lines, AI Account + Project + monitoring + RBAC)infra/core/ai/existing-ai-project.bicep(70 lines, duplicate output shape)ai-project.bicep— single module handles both pathsinfra/core/monitor/applicationinsights-dashboard.bicep(1,236 lines!)Modules (pick-and-choose per template):
ai-project.bicep— AI Account + Project + Capability Host + Log Analytics + App Insights + RBAC + connectionsacr.bicep— Container Registry + connection + role assignmentsconnection.bicep— Generic Foundry Project connection creatorstorage.bicep— Storage account + connection + RBACai-search.bicep— AI Search + knowledge container + connection + RBACbing-grounding.bicep— Bing Search + connection + RBACRemoved:
abbreviations.json(137 lines) — used once, inlinedapplicationinsights-dashboard.bicep(1,236 lines) — dead code, never invokedexisting-ai-project.bicep— merged intoai-project.bicepacr-role-assignment.bicep— inlined intoacr.bicepbing_custom_grounding.bicep— no current samples use itdependentResourcesTypeand JSON array resource discovery patternenableHostedAgents,enableCapabilityHost,enableMonitoringtoggle flags@allowedlocation list (25 entries) — handled by azd extension via azure-dev#7930Output variable renames to match platform-injected environment variables:
AZURE_AI_PROJECT_ENDPOINT→FOUNDRY_PROJECT_ENDPOINTAZURE_AI_PROJECT_ID/AZURE_AI_FOUNDRY_PROJECT_ID→FOUNDRY_PROJECT_ARM_IDAPPLICATIONINSIGHTS_CONNECTION_STRING— already matches, unchangedCI: Bicep validation workflow (
.github/workflows/bicep-validate.yml)bicep lint+bicep buildon all files (no Azure creds needed)az deployment sub validateagainst 4 scenario parameter filesaz deployment sub what-ifpreview for each scenarioTest scenarios:
new-projectnew-project-with-modelexisting-projectexisting-project-new-acrSummary
27 files changed, 949 insertions(+), 2,877 deletions(-)
main.parameters.jsonparamsmain.bicep