allow using none
statements in bicepparam files at build-params
command
#15107
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
There should be multiple
.bicep
files (per project, per layer, etc.) and multiple.bicepparam
files pairing with.bicep
files (withusing {filename}.bicep
statements in.bicepparam
files)When
az deployment group create --resource-group $rgname --name $rgname --template-file ./main.bicep --parameters ./main.bicepparam
command executed,az cli
downstreams the parameters tobicep build-params
command.Since the
.bicep
and.bicepparam
files are paired with theusing
statement in.bicepparam
file, it's not possible to re-use the same.bicepparam
file with multiple deployments.This PR relaxes the check in the
build-params
command that requires theusing
statement in the.bicepparam
file points to the same.bicep
file as thebuild-params
command argumentsSo, if the
.bicepparam
file has ausing none
statement, it'll be possible to use the same.bicepparam
file in multiple deployments.Testing the PR
When you run the following command;
It fails with the following error message;
Bicep file ./main.bicep provided with --bicep-file can only be used if the Bicep parameters "using" declaration refers to a Bicep file on disk.
With the changes in this PR, same command runs successfully and builds the
main.bicepparam
fileBuildParamsCommandTests
I also added a test (https://github.com/Azure/bicep/pull/15107/files#diff-30f70729cbd5bcbfb69d4edd8ff3fa9bee94690e92f5e3e86ac9a7eb98b3f550R431) to ensure the
build-params
command successfully builds given.bicepparam
file when there is ausing none
statement instead of ausing {filename}.bicep
statement in the.bicepparam
file.Microsoft Reviewers: Open in CodeFlow