Skip to content

Support array indexers with names and not just ordinal values #1853

@johndowns

Description

@johndowns

When creating resources like virtual networks with subnets, I often want to refer to the subnet resource ID in another resource or as an output. Because the subnet property of the VNet is an array, the way I can reference that today is:

vnet.properties.subnets[0].id

I don't like this, because it is brittle to changes in the ordering of the subnets. What I'd love to be able to do instead is something like this:

vnet.properties.subnets[vmSubnetName].id

Currently the workaround I'm using is to use the resourceId() function directly, but it'd be nicer if Bicep supported this using the symbolic referencing syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions