You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Assuming a bicep template is deployed into a ResourceGroup located in eastus, the following code snippet should set the default value of locationName to 'eastus', but allow override to the allowed set of alternate regions.
Instead, we get this error, indicating the value is likely checked against the list of allowed values before it is evaluated to 'eastus', which is one of the allowed values and should be valid.
Error BCP027: The parameter expects a default value of type "'centralus' | 'eastus' | 'eastus2' | 'westus' | 'westus2'" but provided value is of type "string".
I think it's reasonable to want to both use as a default the Resource Group location, and then limit what alternatives can be chosen. Meaning, this code should work. I think any other variants of expressions allowed in a default value should also be evaluated to the final string result before the comparison with the @Allowed list is performed.
To Reproduce
Steps to reproduce described above - this is simple to reproduce.
Additional context
N/A
The text was updated successfully, but these errors were encountered:
@majastrz You agree that's a bit of a hack, though, right? (it was certainly not documented nor intuitive.)
I also think that it should be possible to indicate the @Allowed set is matched in a case-insensitive way, as in many cases, Microsoft has names which show up capitalized or uncapitalized in different contexts.
Case in point this very example - these location names often appear as 'EastUS' in one setting or in documentation, but 'eastus' in others, as in what's returned from the resourceGroup().location function.
Bicep version
Bicep CLI version 0.10.61 (8f44805)
Describe the bug
Assuming a bicep template is deployed into a ResourceGroup located in eastus, the following code snippet should set the default value of locationName to 'eastus', but allow override to the allowed set of alternate regions.
Instead, we get this error, indicating the value is likely checked against the list of allowed values before it is evaluated to 'eastus', which is one of the allowed values and should be valid.
I think it's reasonable to want to both use as a default the Resource Group location, and then limit what alternatives can be chosen. Meaning, this code should work. I think any other variants of expressions allowed in a default value should also be evaluated to the final string result before the comparison with the @Allowed list is performed.
To Reproduce
Steps to reproduce described above - this is simple to reproduce.
Additional context
N/A
The text was updated successfully, but these errors were encountered: