Skip to content

Enable Resource-derived Types to work with discriminators #18219

@AlexanderSehr

Description

@AlexanderSehr

Is your feature request related to a problem? Please describe.

As you may be aware, many resource have properties / payloads that can differ vastly depending on the value of one property (which is similar to our discriminated types).

For example

Either case evident by the comment // For remaining properties, see MetricAlertCriteria objects.

In Bicep today, one needs to implement User-defined Types for these cases (ref: AVM web/site), which in case of AVM's web-site module meant adding a bit more than 1.000 lines to provide a type for each scenario.

When trying to create a Resource-derived Type for these properties you end up with:

Image

And nothing beyond.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Personally, it would be great if the already great RDTs feature could be expanded upon so that it can drill further based on the chosen discriminator. I.e., similar to how you can reference a property of an array type via the [*] like in

param subnetName resourceInput<'Microsoft.Network/virtualNetworks@2024-10-01'>.properties.subnets[*].name

it would be great to be able to do something similar for discriminated types like

param httpSettings resourceInput<'Microsoft.Web/sites/config@2024-11-01'>.properties['authsettingsV2'].httpSettings

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions