Adding service endpoint to subnets #13249
-
I'm trying to add a service endpoint to my array of subnets in my virtual network module. However I get an error that the language expression property of "serviceEndpoints" doesn't exist. Not sure if its because the service endpoints property is an array so needs to be handled differently?
Module File -
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You need to add conditional checks for the subnets: [for subnet in subnets: {
name: subnet.name
properties: {
addressPrefix: subnet.addressPrefix
networkSecurityGroup: contains(subnet, 'networkSecurityGroupId') ? {
id: subnet.networkSecurityGroupId
} : null
routeTable: contains(subnet, 'routeTableId') ? {
id: subnet.routeTableId
} : null
natGateway: contains(subnet, 'natGatewayId') ? {
id: subnet.natGatewayId
} : null
serviceEndpoints: subnet.?serviceEndpoints ?? []
}
}] With these checks, if |
Beta Was this translation helpful? Give feedback.
You need to add conditional checks for the
serviceEndpoints
property. Your first subnet does not include that property, so the validation is failing. You can use safe-dereferences to solve this: