Skip to content

Parameterized Bicep variables imports #15404

Answered by GABRIELNGBTUC
nonsocode asked this question in Ideas
Discussion options

You must be logged in to vote

Personally I feel it would needlessly complicate compile time imports with little added value.

Maybe it's just that the example is too simple but from what I see, user defined functions already fill that gap and this example is the equivalent of doing:

imported file:

@export()
func getResourceNames(maxReplicas int, connector string) array => map(range(1, maxReplicas), i => 'resource-${connector}-${i}')

main.bicep:

import * as vars from './variables.bicep' 
param maxReplicas int
param  connector string

resource myFoo 'My.Namespace/resource@2023-11-01' = [for name in vars.getResourceNames(maxReplicas, connector): {
  name: name
  properties: {}
}]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nonsocode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants