bicep
bicep copied to clipboard
Build with no Resources declared creates bad output
Bicep version Bicep CLI version 0.6.18 (46dd19e8eb)
Describe the bug
- When doing a build on a bicep file that does not have any resources declared it will create the resources block as
"resources": {}. - When attempting to deploy the same file to a Bicep Registry it will fail the upload with the following error message.
pathToFolder\bicep\modules\naming.bicep(115,1) : Error BCP018: Expected the "]" character at this location.
pathToFolder\bicep\modules\naming.bicep(115,1) : Error BCP019: Expected a new line character at this location.
To Reproduce Steps to reproduce the behavior:
- Build
- Open VSCode
- Locate File in Explorer Blade
- Right Click on File
- Select
Build ARM Template - Open the new
.jsonfile - Scroll down to the
"resources":section- Find
"resources": {},
- Find
- Registry Deploy
- Open PowerShell 7.2.6
- Create
$bicepFileVariable$bicepFile = 'pathToFolder\bicep\modules\naming.bicep'
- Create
$bicepTargetRootVariable$bicepTargetRoot = 'br:registryname.azurecr.io'
- Run
az bicep publish --file $bicepFile --target "$bicepTargetRoot/bicep/modules/naming:v1"
EDIT
Added a scrubbed copy of the build output. The file name will need to be changed from naming.json.txt to naming.json due to GitHub upload conditions.
Since the running the bicep installer does not upgrade the az bicep commands, I was leveraging Bicep CLI version 0.6.18 (46dd19e8eb) instead of Bicep CLI version 0.10.61 (8f44805506) for my test. After running az bicep upgrade I can confirm that this bug was fixed in the 0.10.61 release.