-
Notifications
You must be signed in to change notification settings - Fork 815
Description
Bicep version
Bicep CLI version 0.29.47 (132ade5)
Describe the bug
As described in #13994, when using readEnvironmentVariable() without a default value in a .bicepparams file, the value get underlined with an error.
This is confusing to the user as when just editing a file it's reasonable to expect users not to have every single deployment variable set with a real value just to edit the file. To make matters worse, this error cascades wherever that parameter is used (e.g. in a string template for another parameter) which can quickly litter your file with inactionable errors and obscure other errors.
#13994 was closed because details were added on how to export variables in PowerShell, but that's besides the point - users shouldn't have to supply every variable just to edit the file. Bicep already fails if it can't read the env variable when it's called to compile a template, and that should be enough.
To Reproduce
Steps to reproduce the behavior:
- Generate a bicepparams file like so:
param baseName = readEnvironmentVariable('BICEP_BASE_NAME', 'myapp') param environmentName = readEnvironmentVariable('BICEP_ENVIRONMENT_NAME') param uniqueSuffix = substring(uniqueString(readEnvironmentVariable('BICEP_RESOURCE_GROUP')), 0, 10) // ... param aiHubName = readEnvironmentVariable('BICEP_AI_HUB_NAME', '${baseName}-${environmentName}-aih') param aiProjectName = readEnvironmentVariable('BICEP_AI_PROJECT_NAME', '${baseName}-${environmentName}-aip') param appInsightsName = readEnvironmentVariable('BICEP_APP_INSIGHTS_NAME', '${baseName}-${environmentName}-appi') // ...
Additional context
BCP338 should be a configurable linter rule (side note, why are rules referenced by name only and only some are given names? every lint should be able to be enabled/disabled simply by its ID).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status