Skip to content

Commit

Permalink
fix: Set subnet batch size decorator (Azure#1771)
Browse files Browse the repository at this point in the history
## Description
Rerunning the vnet module with multiple subnets over an existing vnet
resource can at times cause a 'another operation is in progress' error.
For this reason the batchSize decorator has been added for the
subsequent subnet child module call to minimise this error.

<!--
>Thank you for your contribution !
> Please include a summary of the change and which issue is fixed.
> Please also include the context.
> List any dependencies that are required for this change.

Fixes Azure#1519
Closes Azure#1519
-->

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.network.virtual-network](https://github.com/rodney-almeida/bicep-registry-modules/actions/workflows/avm.res.network.virtual-network.yml/badge.svg?branch=rodney-almeida%2F1519)](https://github.com/rodney-almeida/bicep-registry-modules/actions/workflows/avm.res.network.virtual-network.yml)
|

## Type of Change

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utlities (Non-module effecting
changes)
- [x] Azure Verified Module updates:
- [x] Bugfix containing backwards compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [x] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [x] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to day with the contribution guide at
https://aka.ms/avm/contribute/bicep -->

---------

Co-authored-by: Rodney Almeida <[email protected]>
Co-authored-by: ChrisSidebotham-MSFT <[email protected]>
  • Loading branch information
3 people authored May 6, 2024
1 parent 4e222b9 commit 734b6d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions avm/res/network/virtual-network/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ resource virtualNetwork 'Microsoft.Network/virtualNetworks@2023-04-01' = {
// You can safely remove the below child module (virtualNetwork_subnets) in your consumption of the module (virtualNetworks) to reduce the template size and duplication.
//NOTE End : ------------------------------------

@batchSize(1)
module virtualNetwork_subnets 'subnet/main.bicep' = [
for (subnet, index) in subnets: {
name: '${uniqueString(deployment().name, location)}-subnet-${index}'
Expand Down
4 changes: 3 additions & 1 deletion avm/res/network/virtual-network/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@
"virtualNetwork_subnets": {
"copy": {
"name": "virtualNetwork_subnets",
"count": "[length(parameters('subnets'))]"
"count": "[length(parameters('subnets'))]",
"mode": "serial",
"batchSize": 1
},
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
Expand Down

0 comments on commit 734b6d1

Please sign in to comment.