Skip to content

Commit f3e73f0

Browse files
committed
update
1 parent 7a85ef4 commit f3e73f0

File tree

1 file changed

+5
-7
lines changed
  • articles/azure-resource-manager/bicep/diagnostics

1 file changed

+5
-7
lines changed

articles/azure-resource-manager/bicep/diagnostics/bcp144.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ resource demo 'Microsoft.Storage/storageAccounts@2022-09-01' = [for name in name
4242
properties: {}
4343
}]
4444
45-
// This line triggers BCP144
45+
// This line triggers BCP144.
4646
output storageNames array = [for r in demo: r.name]
4747
```
4848

49-
To resolve BCP144, use an array index to access each specific resource in the collection. Instead of looping over the collection directly, loop over the input array and use the index to reference the corresponding item.
50-
51-
## Example of correct Bicep code (resource collection)
49+
To resolve BCP144, use an array index to access each specific resource in the collection.
5250

5351
```bicep
5452
param names array = [
@@ -66,7 +64,7 @@ resource demo 'Microsoft.Storage/storageAccounts@2022-09-01' = [for name in name
6664
properties: {}
6765
}]
6866
69-
// ✅ Correct usage with indexing
67+
// ✅ Correct usage with indexing.
7068
output storageNames array = [for (name, i) in names: demo[i].name]
7169
```
7270

@@ -85,7 +83,7 @@ module storageModule 'storage.bicep' = [for loc in locations: {
8583
}
8684
}]
8785
88-
// This line triggers BCP144
86+
// This line triggers BCP144.
8987
output moduleOutputs array = [for m in storageModule: m.outputs.storageAccountName]
9088
```
9189

@@ -104,7 +102,7 @@ module storageModule 'storage.bicep' = [for loc in locations: {
104102
}
105103
}]
106104
107-
// ✅ Correct usage with indexing
105+
// ✅ Correct usage with indexing.
108106
output moduleOutputs array = [for (loc, i) in locations: storageModule[i].outputs.storageAccountName]
109107
```
110108

0 commit comments

Comments
 (0)