Azure / Azure/bicep

loadTextContent() - parameter as input

Open
#3,816 59 comments 63 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.**

I would like for loadTextContent() to support variable or parameter as input parameter. What I would like to offer is for the end user to specify text from file or to use the default file available. Currently if I use the below syntax I get error:
The value must be a compile-time constant.bicep(BCP032)

I know that function is being used at compile time so this will probably require some other approach and even changes in template spec for supporting it there as well.

```bicep
var alertRules = {
memoryLow: {
description: empty(bastionHostMonitoring.alertRules.memoryLow.descriptionFilePath) ? loadTextContent('alert-descriptions/memory-low.txt') : loadTextContent(bastionHostMonitoring.alertRules.memoryLow.descriptionFilePath)
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the loadTextContent() entry point and the BCP032 compile-time-constant diagnostic described in the issue. Review the requested template spec support as well. Done means users can choose either the supplied text-file path or the default file without the current error, with the required template-spec behavior addressed.

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.