Azure / Azure/bicep

Support float values

Open
#1,386 47 comments 29 reactions 0 assignees View on GitHub
discussion enhancement Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

Follow up from #486

We need to add support for floating point values that can be entered by user.
Floating point values - numbers with dot i.e. `3.14` have following constraints:

* Float values can be entered manually only in the code as a variable or object value
* They cannot be a parameter
* They cannot be an output of an function
* They are not allowed as part of expressions
* There's `float()` function that should be supported - it can be used only in variables and as object values

Valid usage in ARM:
```
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"inPi": {
"type": "string",
"defaultValue": "3.14"
}
},
"functions": [],
"variables": {
"pi": 3.14,
"objectPi": {
"pi": 3.14
},
"pi2": "[float('3.14')]",
"pi3": "[float(variables('pi'))]",
"pi4": "[float(parameters('inPi'))]"
},
"resources": [],
"outputs": {
"out0": {
"type": "object",
"value": "[createObject('pi', variables('pi'))]"
},
"out1": {
"type": "object",
"value": "[variables('objectPi')]"
},
"out2": {
"type": "object",
"value": "[createObject('pi2',variables('pi2'))]"
},
"out3": {
"type": "object",
"value": "[createObject('pi3',variables('pi3'))]"
},
"out4": {
"type": "object",
"value": "[createObject('pi4',variables('pi4'))]"
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with follow-up issue #486 and review the valid ARM template example in this issue. Trace how Bicep handles numeric values, variables, parameters, expressions, outputs, and the float() function, then verify that the listed allowed and disallowed usages are covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.