-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow param assignments to use null
values
#11532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeskew example.bicep param propertyx string example.bicepparam using 'example.bicep'
param propertyx = null using statement throws error like: The following parameters are declared in the Bicep file but are missing an assignment in the params file: "propertyx".bicep(BCP258) |
@slavizh The BCP258 diagnostic is expected because param propertyx string = 'default value' or by declaring the parameter to be nullable (optional without a default value): param propertyx string? |
@jeskew thanks a lot! |
@jeskew I have a question that might be related to this topic I am trying to set a parameter value in bicepparam file from a variable that uses filter function, it failed with this error: Failed to evaluate parameter "resourceName": Unhandled exception during evaluating template language function 'variables' is not handled.bicep(BCP338) Here is the code: using './storageaccount.bicep' var pipeline_content = loadYamlContent('azure-pipelines.yml','parameters') As If it requires from me to do exception handling on the filter function output, any other function apart from filter works good. Weird |
@islammohamed94 Could you open a separate issue? The problem you're running into is that the |
Resolves #11301 and resolves #11531
This PR allows
.bicepparam
files to specify a value ofnull
(or an expression that evaluates tonull
) for optional parameters, as the ARM engine will interpret anull
value as equivalent to no value having been supplied for the parameter. Because this means that the param's default value (which may not be known until deploy time) will be used, this PR also prevents parameters with anull
value from being used in expressions.While working on the block, I noticed that parameters using
az.getSecret
are currently allowed to be used in other expressions in.bicepparam
files, but the compiled value is incorrect (the JSON will use the object value that should appear in the.parameters.json
file). The block was updated to also prohibit references to parameters whose value will be pulled at deploy time from KeyVault.Microsoft Reviewers: codeflow:open?pullrequest=https://github.com/Azure/bicep/pull/11532&drop=dogfoodAlpha