-
Notifications
You must be signed in to change notification settings - Fork 819
BCP033 thrown when using deployment().location and @allowed on subscription deployments #19278
Copy link
Copy link
Open
Labels
Needs: Triage 🔍documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Bicep version
$ az bicep version
Bicep CLI version 0.41.2 (3e403ea7c1)
Describe the bug
When using the @allowed decorator in combination with deployment().location it fails with:
$ az bicep build --file test.bicep
test.bicep(7,7) : Warning no-unused-params: Parameter "location" is declared but never used. [https://aka.ms/bicep/linter-diagnostics#no-unused-params]
test.bicep(7,25) : Error BCP033: Expected a value of type "'eastus2euap' | 'southcentralus'" but the provided value is of type "string". [https://aka.ms/bicep/core-diagnostics#BCP033]
To Reproduce
Contents of test.bicep (minimal reproducible example):
targetScope = 'subscription'
@allowed([
'southcentralus'
'eastus2euap'
])
param location string = deployment().location
Replacing deployment().location with a default hardcoded string (eg. southcentralus) or removing the @allowed decorator, the Bicep file becomes valid.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs: Triage 🔍documentationImprovements or additions to documentationImprovements or additions to documentation
Type
Projects
Status
Todo