Skip to content

Commit

Permalink
feat: Reduce the number of web-request by prefetching more data (#809)
Browse files Browse the repository at this point in the history
## Description

- Reduce the number of web-request by prefetching more data
- Small fix for path split (which was not considering pattern)

| Pipeline |
| - |

[![avm.res.api-management.service](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.api-management.service.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.api-management.service.yml)

[![avm.res.app.managed-environment](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.app.managed-environment.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.app.managed-environment.yml)

[![avm.res.automation.automation-account](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.automation.automation-account.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.automation.automation-account.yml)

[![avm.res.batch.batch-account](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.batch.batch-account.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.batch.batch-account.yml)

[![avm.res.cognitive-services.account](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.cognitive-services.account.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.cognitive-services.account.yml)

[![avm.res.compute.disk-encryption-set](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.disk-encryption-set.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.disk-encryption-set.yml)

[![avm.res.compute.gallery](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.gallery.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.gallery.yml)

[![avm.res.compute.proximity-placement-group](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.proximity-placement-group.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.proximity-placement-group.yml)

[![avm.res.compute.ssh-public-key](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.ssh-public-key.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.ssh-public-key.yml)

[![avm.res.compute.virtual-machine](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.virtual-machine.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.virtual-machine.yml)

[![avm.res.container-service.managed-cluster](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.container-service.managed-cluster.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.container-service.managed-cluster.yml)

[![avm.res.data-factory.factory](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.data-factory.factory.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.data-factory.factory.yml)

[![avm.res.db-for-postgre-sql.flexible-server](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.db-for-postgre-sql.flexible-server.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.db-for-postgre-sql.flexible-server.yml)

[![avm.res.document-db.database-account](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.document-db.database-account.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.document-db.database-account.yml)

[![avm.res.event-grid.domain](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.event-grid.domain.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.event-grid.domain.yml)

[![avm.res.event-grid.system-topic](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.event-grid.system-topic.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.event-grid.system-topic.yml)

[![avm.res.event-grid.topic](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.event-grid.topic.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.event-grid.topic.yml)

[![avm.res.insights.action-group](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.action-group.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.action-group.yml)

[![avm.res.insights.activity-log-alert](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.activity-log-alert.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.activity-log-alert.yml)

[![avm.res.insights.component](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.component.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.component.yml)

[![avm.res.insights.data-collection-endpoint](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.data-collection-endpoint.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.data-collection-endpoint.yml)

[![avm.res.insights.data-collection-rule](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.data-collection-rule.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.data-collection-rule.yml)

[![avm.res.insights.diagnostic-setting](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.diagnostic-setting.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.diagnostic-setting.yml)

[![avm.res.insights.metric-alert](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.metric-alert.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.metric-alert.yml)

[![avm.res.insights.scheduled-query-rule](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.scheduled-query-rule.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.scheduled-query-rule.yml)

[![avm.res.insights.webtest](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.webtest.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.webtest.yml)

[![avm.res.key-vault.vault](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml)

[![avm.res.kubernetes-configuration.extension](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.extension.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.extension.yml)

[![avm.res.kubernetes-configuration.flux-configuration](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.flux-configuration.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.flux-configuration.yml)

[![avm.res.logic.workflow](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.logic.workflow.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.logic.workflow.yml)

[![avm.res.maintenance.maintenance-configuration](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.maintenance.maintenance-configuration.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.maintenance.maintenance-configuration.yml)

[![avm.res.managed-identity.user-assigned-identity](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.managed-identity.user-assigned-identity.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.managed-identity.user-assigned-identity.yml)

[![avm.res.network.application-security-group](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.application-security-group.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.application-security-group.yml)

[![avm.res.network.bastion-host](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.bastion-host.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.bastion-host.yml)

[![avm.res.network.connection](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.connection.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.connection.yml)

[![avm.res.network.ddos-protection-plan](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.ddos-protection-plan.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.ddos-protection-plan.yml)

[![avm.res.network.dns-forwarding-ruleset](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-forwarding-ruleset.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-forwarding-ruleset.yml)

[![avm.res.network.dns-resolver](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-resolver.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-resolver.yml)

[![avm.res.network.dns-zone](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-zone.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-zone.yml)

[![avm.res.network.express-route-circuit](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.express-route-circuit.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.express-route-circuit.yml)

[![avm.res.network.express-route-gateway](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.express-route-gateway.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.express-route-gateway.yml)

[![avm.res.network.firewall-policy](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.firewall-policy.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.firewall-policy.yml)

[![avm.res.network.front-door-web-application-firewall-policy](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.front-door-web-application-firewall-policy.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.front-door-web-application-firewall-policy.yml)

[![avm.res.network.front-door](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.front-door.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.front-door.yml)

[![avm.res.network.load-balancer](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.load-balancer.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.load-balancer.yml)

[![avm.res.network.nat-gateways](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.nat-gateway.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.nat-gateway.yml)

[![avm.res.network.network-interface](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.network-interface.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.network-interface.yml)

[![avm.res.network.network-security-group](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.network-security-group.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.network-security-group.yml)

[![avm.res.network.private-dns-zone](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-dns-zone.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-dns-zone.yml)

[![avm.res.network.private-endpoint](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-endpoint.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-endpoint.yml)

[![avm.res.network.public-ip-address](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-address.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-address.yml)

[![avm.res.network.public-ip-prefix](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-prefix.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-prefix.yml)

[![avm.res.network.route-table](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.route-table.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.route-table.yml)

[![avm.res.network.trafficmanagerprofile](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.trafficmanagerprofile.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.trafficmanagerprofile.yml)

[![avm.res.network.virtual-network](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.virtual-network.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.virtual-network.yml)

[![avm.res.network.vpn-gateway](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.vpn-gateway.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.vpn-gateway.yml)

[![avm.res.network.vpn-site](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.vpn-site.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.vpn-site.yml)

[![avm.res.operational-insights.workspace](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operational-insights.workspace.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operational-insights.workspace.yml)

[![avm.res.operations-management.solution](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operations-management.solution.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operations-management.solution.yml)

[![avm.res.power-bi-dedicated.capacity](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.power-bi-dedicated.capacity.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.power-bi-dedicated.capacity.yml)

[![avm.res.resource-graph.query](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resource-graph.query.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resource-graph.query.yml)

[![avm.res.resources.deployment-script](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resources.deployment-script.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resources.deployment-script.yml)

[![avm.res.resources.resource-group](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resources.resource-group.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resources.resource-group.yml)

[![avm.res.search.search-service](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.search.search-service.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.search.search-service.yml)

[![avm.res.service-bus.namespace](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.service-bus.namespace.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.service-bus.namespace.yml)

[![avm.res.sql.server](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.sql.server.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.sql.server.yml)

[![avm.res.web.serverfarm](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.web.serverfarm.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.web.serverfarm.yml)

[![avm.res.web.static-site](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.web.static-site.yml/badge.svg?branch=users%2Falsehr%2FavmRequestReduce&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.web.static-site.yml)

---------

Co-authored-by: Erika Gressi <[email protected]>
  • Loading branch information
AlexanderSehr and eriqua authored Jan 17, 2024
1 parent c089ef0 commit b23836b
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 51 deletions.
101 changes: 62 additions & 39 deletions avm/utilities/pipelines/sharedScripts/Set-ModuleReadMe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,12 @@ Mandatory. The readme file content array to update
.PARAMETER SectionStartIdentifier
Optional. The identifier of the section. Defaults to '## Data Collection'
.PARAMETER PreLoadedContent
Optional. Pre-Loaded content. May be used to reuse the same data for multiple invocations. For example:
@{
TelemetryFileContent = @() // Optional. The text of the telemetry notice to add to each readme.
}
.EXAMPLE
Set-DataCollectionSection -ReadMeFileContent @('# Title', '', '## Section 1', ...)
Expand All @@ -518,26 +524,34 @@ function Set-DataCollectionSection {
[Parameter(Mandatory)]
[object[]] $ReadMeFileContent,

[Parameter(Mandatory = $false)]
[hashtable] $PreLoadedContent = @{},

[Parameter(Mandatory = $false)]
[string] $SectionStartIdentifier = '## Data Collection'
)

# Load content, if required
if ($PreLoadedContent.Keys -notcontains 'TelemetryFileContent') {

$telemetryUrl = 'https://aka.ms/avm/static/telemetry'
try {
$rawReponse = Invoke-WebRequest -Uri $telemetryUrl
if (($rawReponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") {
$telemetryInfoContent = $rawReponse.Content -split '\n'
} else {
throw "Failed to telemetry information from [$telemetryUrl]." # Incorrect Url (e.g., points to HTML)
$telemetryUrl = 'https://aka.ms/avm/static/telemetry'
try {
$rawResponse = Invoke-WebRequest -Uri $telemetryUrl
if (($rawResponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") {
$telemetryFileContent = $rawResponse.Content -split '\n'
} else {
throw "Failed to telemetry information from [$telemetryUrl]." # Incorrect Url (e.g., points to HTML)
}
} catch {
throw "Failed to telemetry information from [$telemetryUrl]." # Invalid url
}
} catch {
throw "Failed to telemetry information from [$telemetryUrl]." # Invalid url
} else {
$telemetryFileContent = $PreLoadedContent.TelemetryFileContent
}

# Build result
if ($PSCmdlet.ShouldProcess('Original file with new output content', 'Merge')) {
$updatedFileContent = Merge-FileWithNewContent -oldContent $ReadMeFileContent -newContent $telemetryInfoContent -SectionStartIdentifier $SectionStartIdentifier -contentType 'nextH2'
$updatedFileContent = Merge-FileWithNewContent -oldContent $ReadMeFileContent -newContent $telemetryFileContent -SectionStartIdentifier $SectionStartIdentifier -contentType 'nextH2'
}
return $updatedFileContent
}
Expand All @@ -564,11 +578,14 @@ Mandatory. The readme file content array to update
.PARAMETER SectionStartIdentifier
Optional. The identifier of the 'outputs' section. Defaults to '## Cross-referenced modules'
.PARAMETER CrossReferencedModuleList
Required. The Cross Module References to consider when refreshing the readme.
.PARAMETER PreLoadedContent
Optional. Pre-Loaded content. May be used to reuse the same data for multiple invocations. For example:
@{
CrossReferencedModuleList = @{} // Optional. Cross Module References to consider when refreshing the readme. Can be provided to speed up the generation. If not provided, is fetched by this script.
}
.EXAMPLE
Set-CrossReferencesSection -ModuleRoot 'C:/key-vault/vault' -FullModuleIdentifier 'key-vault/vault' -TemplateFileContent @{ resource = @{}; ... } -ReadMeFileContent @('# Title', '', '## Section 1', ...) -CrossReferencedModuleList @{}
Set-CrossReferencesSection -ModuleRoot 'C:/key-vault/vault' -FullModuleIdentifier 'key-vault/vault' -TemplateFileContent @{ resource = @{}; ... } -ReadMeFileContent @('# Title', '', '## Section 1', ...) -PreLoadedContent @{ CrossReferencedModuleList = @{ ... } }
Update the given readme file's 'Cross-referenced modules' section based on the given template file content
#>
function Set-CrossReferencesSection {
Expand All @@ -587,13 +604,20 @@ function Set-CrossReferencesSection {
[Parameter(Mandatory)]
[object[]] $ReadMeFileContent,

[Parameter(Mandatory)]
[hashtable] $CrossReferencedModuleList,
[Parameter(Mandatory = $false)]
[hashtable] $PreLoadedContent = @{},

[Parameter(Mandatory = $false)]
[string] $SectionStartIdentifier = '## Cross-referenced modules'
)

# Load content, if required
if ($PreLoadedContent.Keys -notcontains 'CrossReferencedModuleList') {
$CrossReferencedModuleList = Get-CrossReferencedModuleList
} else {
$CrossReferencedModuleList = $PreLoadedContent.CrossReferencedModuleList
}

# Process content
$SectionContent = [System.Collections.ArrayList]@(
'This section gives you an overview of all local-referenced module files (i.e., other CARML modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).',
Expand Down Expand Up @@ -1574,19 +1598,20 @@ Supports both ARM & bicep templates.
.PARAMETER TemplateFilePath
Mandatory. The path to the template to update
.PARAMETER TemplateFileContent
Optional. The template file content to process. If not provided, the template file content will be read from the TemplateFilePath file.
Using this property is useful if you already compiled the bicep template before invoking this function and want to avoid re-compiling it.
.PARAMETER ReadMeFilePath
Optional. The path to the readme to update. If not provided assumes a 'README.md' file in the same folder as the template
.PARAMETER SectionsToRefresh
Optional. The sections to update. By default it refreshes all that are supported.
Currently supports: 'Resource Types', 'Parameters', 'Outputs', 'Template references'
.PARAMETER CrossReferencedModuleList
Optional. Cross Module References to consider when refreshing the readme. Can be provided to speed up the generation. If not provided, is fetched by this script.
.PARAMETER PreLoadedContent
Optional. Pre-Loaded content. May be used to reuse the same data for multiple invocations. For example:
@{
CrossReferencedModuleList = @{} // Optional. Cross Module References to consider when refreshing the readme. Can be provided to speed up the generation. If not provided, is fetched by this script.
TemplateFileContent = @{} // Optional. The template file content to process. If not provided, the template file content will be read from the TemplateFilePath file.
TelemetryFileContent = @() // Optional. The text of the telemetry notice to add to each readme.
}
.EXAMPLE
Set-ModuleReadMe -TemplateFilePath 'C:\main.bicep'
Expand All @@ -1599,9 +1624,9 @@ Set-ModuleReadMe -TemplateFilePath 'C:/network/load-balancer/main.bicep' -Sectio
Generate the Module ReadMe only for specific sections. Updates only the sections `Parameters` & `Outputs`. Other sections remain untouched.
.EXAMPLE
Set-ModuleReadMe -TemplateFilePath 'C:/network/load-balancer/main.bicep' -TemplateFileContent @{...}
Set-ModuleReadMe -TemplateFilePath 'C:/network/load-balancer/main.bicep' -PreLoadedContent @{ TemplateFileContent = @{...} }
(Re)Generate the readme file for template 'loadBalancer' based on the content provided in the TemplateFileContent parameter
(Re)Generate the readme file for template 'loadBalancer' based on the content provided in the PreLoadedContent.TemplateFileContent parameter
.EXAMPLE
Set-ModuleReadMe -TemplateFilePath 'C:/network/load-balancer/main.bicep' -ReadMeFilePath 'C:/differentFolder'
Expand All @@ -1618,17 +1643,14 @@ function Set-ModuleReadMe {

[CmdletBinding(SupportsShouldProcess = $true)]
param (
[Parameter(Mandatory)]
[Parameter(Mandatory = $true)]
[string] $TemplateFilePath,

[Parameter(Mandatory = $false)]
[hashtable] $TemplateFileContent,

[Parameter(Mandatory = $false)]
[string] $ReadMeFilePath = (Join-Path (Split-Path $TemplateFilePath -Parent) 'README.md'),

[Parameter(Mandatory = $false)]
[hashtable] $CrossReferencedModuleList = @{},
[hashtable] $PreLoadedContent = @{},

[Parameter(Mandatory = $false)]
[ValidateSet(
Expand Down Expand Up @@ -1660,6 +1682,7 @@ function Set-ModuleReadMe {
. (Join-Path $PSScriptRoot 'helper' 'Get-SpecsAlignedResourceName.ps1')
. (Join-Path $PSScriptRoot 'helper' 'ConvertTo-OrderedHashtable.ps1')
. (Join-Path $PSScriptRoot 'Get-BRMRepositoryName.ps1')
. (Join-Path $PSScriptRoot 'helper' 'Get-CrossReferencedModuleList.ps1')

# Check template & make full path
$TemplateFilePath = Resolve-Path -Path $TemplateFilePath -ErrorAction Stop
Expand All @@ -1668,20 +1691,23 @@ function Set-ModuleReadMe {
throw "[$TemplateFilePath] is no valid file path."
}

if (-not $TemplateFileContent) {
# Build template, if required
if ($PreLoadedContent.Keys -notcontains 'TemplateFileContent') {
if ((Split-Path -Path $TemplateFilePath -Extension) -eq '.bicep') {
$templateFileContent = bicep build $TemplateFilePath --stdout | ConvertFrom-Json -AsHashtable
} else {
$templateFileContent = ConvertFrom-Json (Get-Content $TemplateFilePath -Encoding 'utf8' -Raw) -ErrorAction 'Stop' -AsHashtable
}
} else {
$templateFileContent = $PreLoadedContent.TemplateFileContent
}

if (-not $templateFileContent) {
throw "Failed to compile [$TemplateFilePath]"
}

$moduleRoot = Split-Path $TemplateFilePath -Parent
$fullModuleIdentifier = $moduleRoot.Replace('\', '/').split('res/')[-1]
$fullModuleIdentifier = ($moduleRoot -split '[\/|\\]{1}avm[\/|\\]{1}(res|ptn)[\/|\\]{1}')[2] -replace '\\', '/'
# Custom modules are modules having the same resource type but different properties based on the name
# E.g., web/site/config--appsetting vs web/site/config--authsettingv2
$customModuleSeparator = '--'
Expand Down Expand Up @@ -1769,16 +1795,12 @@ function Set-ModuleReadMe {
if ($SectionsToRefresh -contains 'CrossReferences') {
# Handle [CrossReferences] section
# ========================
if ($CrossReferencedModuleList.Count -eq 0) {
. (Join-Path $PSScriptRoot 'helper' 'Get-CrossReferencedModuleList.ps1')
$CrossReferencedModuleList = Get-CrossReferencedModuleList
}
$inputObject = @{
ModuleRoot = $ModuleRoot
FullModuleIdentifier = $fullModuleIdentifier
ReadMeFileContent = $readMeFileContent
TemplateFileContent = $templateFileContent
CrossReferencedModuleList = $CrossReferencedModuleList
ModuleRoot = $ModuleRoot
FullModuleIdentifier = $fullModuleIdentifier
ReadMeFileContent = $readMeFileContent
TemplateFileContent = $templateFileContent
PreLoadedContent = $PreLoadedContent
}
$readMeFileContent = Set-CrossReferencesSection @inputObject
}
Expand All @@ -1795,6 +1817,7 @@ function Set-ModuleReadMe {
# ========================
$inputObject = @{
ReadMeFileContent = $readMeFileContent
PreLoadedContent = $PreLoadedContent
}
$readMeFileContent = Set-DataCollectionSection @inputObject
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ Describe 'Module tests' -Tag 'Module' {
$templateFilePath = Join-Path $moduleFolderPath 'main.bicep'

$readmeFileTestCases += @{
moduleFolderName = $resourceTypeIdentifier
templateContent = $builtTestFileMap[$templateFilePath]
templateFilePath = $templateFilePath
readMeFilePath = Join-Path -Path $moduleFolderPath 'README.md'
moduleFolderName = $resourceTypeIdentifier
templateFileContent = $builtTestFileMap[$templateFilePath]
templateFilePath = $templateFilePath
readMeFilePath = Join-Path -Path $moduleFolderPath 'README.md'
}
}

Expand All @@ -307,7 +307,7 @@ Describe 'Module tests' -Tag 'Module' {
. (Join-Path $repoRootPath 'avm' 'utilities' 'pipelines' 'sharedScripts' 'Set-ModuleReadMe.ps1')

# Apply update with already compiled template content
Set-ModuleReadMe -TemplateFilePath $templateFilePath -TemplateFileContent $templateFileContent
Set-ModuleReadMe -TemplateFilePath $templateFilePath -PreLoadedContent @{ TemplateFileContent = $templateFileContent }

# Get hash after 'update'
$fileHashAfter = (Get-FileHash $readMeFilePath).Hash
Expand Down Expand Up @@ -704,9 +704,9 @@ Describe 'Module tests' -Tag 'Module' {
$implementedSchema = $templateFileContentBicep[$implementedSchemaStartIndex..$implementedSchemaEndIndex]

try {
$rawReponse = Invoke-WebRequest -Uri $expectedUdtUrl
if (($rawReponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") {
$expectedSchemaFull = $rawReponse.Content -split '\n'
$rawResponse = Invoke-WebRequest -Uri $expectedUdtUrl
if (($rawResponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") {
$expectedSchemaFull = $rawResponse.Content -split '\n'
} else {
throw "Failed to fetch schema from [$expectedUdtUrl]. Skipping schema check"
}
Expand Down
29 changes: 25 additions & 4 deletions avm/utilities/tools/Set-AVMModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ function Set-AVMModule {
# load cross-references
$crossReferencedModuleList = Get-CrossReferencedModuleList

# load AVM references (done to reduce WebRequests to GitHub repository)
# Telemetry
$telemetryUrl = 'https://aka.ms/avm/static/telemetry'
try {
$rawResponse = Invoke-WebRequest -Uri $telemetryUrl
if (($rawResponse.Headers['Content-Type'] | Out-String) -like "*text/plain*") {
$TelemetryFileContent = $rawResponse.Content -split '\n'
} else {
throw "Failed to telemetry information from [$telemetryUrl]." # Incorrect Url (e.g., points to HTML)
}
} catch {
throw "Failed to telemetry information from [$telemetryUrl]." # Invalid url
}

# create reference as it must be loaded in the thread to work
$ReadMeScriptFilePath = (Join-Path (Get-Item $PSScriptRoot).Parent.FullName 'pipelines' 'sharedScripts' 'Set-ModuleReadMe.ps1')
} else {
Expand Down Expand Up @@ -137,11 +151,18 @@ function Set-AVMModule {
if (-not $using:SkipReadMe) {
Write-Output "Generating readme for [$resourceTypeIdentifier]"

# If the template was just build, we can pass the JSON into the readme script to be more efficient
$readmeTemplateFilePath = (-not $using:SkipBuild) ? (Join-Path (Split-Path $_ -Parent) 'main.json') : $_

. $using:ReadMeScriptFilePath
Set-ModuleReadMe -TemplateFilePath $readmeTemplateFilePath -CrossReferencedModuleList $using:crossReferencedModuleList
$readmeInputObject = @{
TemplateFilePath = $_
PreLoadedContent = @{
CrossReferencedModuleList = $using:crossReferencedModuleList
TelemetryFileContent = $using:TelemetryFileContent
} + (-not $using:SkipBuild ? @{
# If the template was just build, we can pass the JSON into the readme script to be more efficient
TemplateFileContent = ConvertFrom-Json (Get-Content (Join-Path (Split-Path $_ -Parent) 'main.json') -Encoding 'utf8' -Raw) -ErrorAction 'Stop' -AsHashtable
} : @{})
}
Set-ModuleReadMe @readmeInputObject
}
}

Expand Down

0 comments on commit b23836b

Please sign in to comment.