Azure / Azure/bicep

String functions for compile time

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

Description

**Is your feature request related to a problem? Please describe.**
When working with bicep files and loading JSON/text content to be used as an input, we are performing some string replacement functions.

For example,
```
var customPolicies = string(loadJsonContent('../../inputs/policies.json'))
var customPoliciesModified1 = replace(customPolicies, "valueOld", "valueNew")
var customPoliciesModified = array(json(customPoliciesModified1))
```

Currently, this gets converted into ARM functions and increases the size of the deployment and with large JSONs and many replaces it hits ARM limit on string literals in ARM template expressions.

**Describe the solution you'd like**
A way to apply string functions at a compile time.

Contributor guide

Open the contributing guide

Research direction

Start from the compile-time handling of string operations in the Bicep compiler and compare it with the loadJsonContent example in the issue. Determine how compile-time replacement and JSON conversion should appear in the generated ARM template, then validate that large inputs no longer expand into ARM string expressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.