Azure / Azure/arm-template-parser
Passing object-parameter results in odd/unformatted Template
- Dominant language
- C#
- Stars
- 4
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
When passing a parameter-object (like tags) to the template using the `-p` flag, the resulting template has a strange type, and the name is not formatted at all.
**Example template**:
```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceToken": {
"type": "string",
"defaultValue": "token"
},
"tags": {
"type": "object"
}
},
"resources": [
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2022-03-01",
"name": "[format('{0}/{1}', format('web-{0}', parameters('resourceToken')), 'appsettings')]",
"properties": {
"SCM_DO_BUILD_DURING_DEPLOYMENT": "true"
}
}
]
}
```
**Invocation**:
```bash
./Template.Parser.Cli -s example.json -p tags="{'azd-env-name': 'myenv'}"
```
**Actual result**:
```json
{
"type": "format('web-{0}',",
"apiVersion": "2022-03-01",
"name": "[format('{0}/{1}', format('web-{0}', parameters('resourceToken')), 'appsettings')]",
"properties": {
"SCM_DO_BUILD_DURING_DEPLOYMENT": "true"
}
}
```
**Expected result**:
The type should not be modified/mangled.
If the CLI cannot parse the provided parameter-value, I would expect:
- an error, or
- that parameter to be ignored
But for unrelated fields to be mangled, that's a bit surprising.
### Workaround
It does work correctly when providing the parameters in a file, using the `-f parameter.json` flag.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.