Azure / Azure/bicep

Bicep warning BCP334 is not correct when using several string functions.

Open
#12,271 7 comments 0 reactions 0 assignees View on GitHub
Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
0.22.6

**Describe the bug**
I am receiving a BCP334 warning for a case that cannot occur. I am starting the name with the static value of `stflow`.

``` output
Warning BCP334: The provided value can have a length as small as 0 and may be too short to assign to a target with a configured minimum length of 3.
```

**To Reproduce**
```bicep
var flowLogStorageName = take(replace(toLower('stflow${resourceName}${uniqueString(resourceGroup().id, resourceName)}'),'-',''),24)
resource flowLogStor 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: flowLogStorageName
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
location: location
properties: {
minimumTlsVersion: 'TLS1_2'
}
}
```

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the BCP334 warning with the Bicep snippet in the issue, then trace the diagnostic logic for minimum-length analysis across take, replace, and toLower. Done means this valid expression no longer produces a false warning while genuinely short values still produce BCP334.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.