We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Bicep version
> az bicep version Bicep CLI version 0.26.54 (5e20b29b58)
Describe the bug
I have a user defined function that is called "genModuleTags" and looks like this:
type moduleTags = { *: string } @export() func genModuleTags(mdFileContent string, moduleName string, moduleRace string) moduleTags => { '${contains(moduleName, 'zoo') ? 'Zoo' : 'Genum'} name': moduleName '${contains(moduleName, 'zoo') ? 'Zoo' : 'Genum'} race': moduleRace '${contains(moduleName, 'zoo') ? 'Zoo' : 'Genum'} version': trim(split( filter(split(mdFileContent, '\n'), (item) => contains(item, 'Version:'))[0], ':' )[1]) }
If I deploy the following bicep file:
import * as sharedTypes from '../race1.bicep' var moduleTags = sharedTypes.genModuleTags( loadTextContent('../races/race1/shared-types race1.md'), 'shared-types', 'race1' ) output moduleTags object = moduleTags
I get the expected output:
"outputs": { "moduleTags": { "type": "Object", "value": { "Genum name": "shared-types", "Genum race": "race1", "Genum version": "1.1.0" } } }
But if I publish the module to an ACR and run the same file but using the ACR module instead:
// import * as sharedTypes from '../race1.bicep' import * as sharedTypes from 'br:<acrName>.azurecr.io/shared-types/race1:version_1.1.0' var moduleTags = sharedTypes.genModuleTags( loadTextContent('../races/race1/shared-types race1.md'), 'shared-types', 'race1' ) output moduleTags object = moduleTags
The output is malformed, the keys in the object not being rendered correctly:
"outputs": { "moduleTags": { "type": "Object", "value": { "[format('{0} name', if(contains(parameters('moduleName'), 'zoo'), 'Zoo', 'Genum'))]": "shared-types", "[format('{0} race', if(contains(parameters('moduleName'), 'zoo'), 'Zoo', 'Genum'))]": "race1", "[format('{0} version', if(contains(parameters('moduleName'), 'zoo'), 'Zoo', 'Genum'))]": "1.1.0" } } }
To Reproduce
type moduleTags = { *: string } @export() func genModuleTags(moduleName string) moduleTags => { '${contains(moduleName, 'name') ? 'name' : 'noName '} name': moduleName }
Make another file that can reference the function using imports:
import * as sharedTypes from 'br:<url to the module>' var moduleTags = sharedTypes.genModuleTags('name') output moduleTags object = moduleTags
And run the bicep file that imports the function, the result should be that the resulting objects keys has not been rendered correctly.
"outputs": { "moduleTags": { "type": "Object", "value": { "[format('{0} name', if(contains(parameters('moduleName'), 'name'), 'name', 'noName '))]": "name" } } }
The text was updated successfully, but these errors were encountered:
Thanks for reporting this! Looks like we have a bug in how we read back ARM expressions in object keys - I've submitted a fix.
Sorry, something went wrong.
Awesome, thank you for the quick work and response.
Fix bug with parsing expressions in object keys from ARM templates (#…
b784409
…13665) Closes #13663 ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/13665)
Successfully merging a pull request may close this issue.
Bicep version
> az bicep version Bicep CLI version 0.26.54 (5e20b29b58)
Describe the bug
I have a user defined function that is called "genModuleTags" and looks like this:
If I deploy the following bicep file:
I get the expected output:
But if I publish the module to an ACR and run the same file but using the ACR module instead:
The output is malformed, the keys in the object not being rendered correctly:
To Reproduce
Make another file that can reference the function using imports:
And run the bicep file that imports the function, the result should be that the resulting objects keys has not been rendered correctly.
The text was updated successfully, but these errors were encountered: