Introduce local variables and allow referencing them as default values for parameters.
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
Introduce local variables and allow referencing them as default values for parameters.
It would be great to be able to read default values from json file as shown in example below.
This would allow to use bicep as ARM template generator and final form of ARM template would not need to have additional object parameters with JSON in it as it is now with param object.
This would also help with using bicep within YAML pipelines as one could convert YAML settings from template directly into json file which bicep could read in following task and generate ARM template with default values sourced from external file.
Sample configuration.
params.json:
```json
{
"resourceGroupName": "rg-xxx",
"storageName": "xxx",
"containers": [
"xxx"
],
"storageSKU": "Standard_GRS"
}
```
```bicep
targetScope = 'subscription'
local params = json(loadTextContent('./params.json'))
param resourceGroupName string = params.resourceGroupName
param storageName string = params.storageName
param storageSKU string = params.storageSKU
param containers array = params.containers
```
Contributor guide
Research direction
Start with the params.json example and accompanying Bicep snippet to understand the requested local-variable and parameter-default behavior. Done means Bicep can read the external JSON values through a local variable and use them as parameter defaults, while preserving the intended ARM template output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100