Skip to content

Commit

Permalink
Simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Feb 14, 2025
1 parent c7c0663 commit b302e98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions avm/res/digital-twins/digital-twins-instance/endpoint/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ var identity = !empty(properties.?authentication.?managedIdentities)
resource eventGridTopic 'Microsoft.EventGrid/topics@2022-06-15' existing = if (properties.endpointType == 'EventGrid') {
name: last(split(properties.?eventGridTopicResourceId, '/'))
scope: resourceGroup(
split((properties.?eventGridTopicResourceId ?? '//'), '/')[2],
split((properties.?eventGridTopicResourceId ?? '////'), '/')[4]
split(properties.?eventGridTopicResourceId, '/')[2],
split(properties.?eventGridTopicResourceId, '/')[4]
)
}

resource eventHubNamespace 'Microsoft.EventHub/namespaces@2024-01-01' existing = if (properties.endpointType == 'EventHub') {
name: split((properties.authentication.eventHubResourceId ?? '////'), '/')[8]
name: split(properties.authentication.eventHubResourceId, '/')[8]
scope: resourceGroup(
split((properties.authentication.eventHubResourceId ?? '//'), '/')[2],
split((properties.authentication.eventHubResourceId ?? '////'), '/')[4]
split(properties.authentication.eventHubResourceId, '/')[2],
split(properties.authentication.eventHubResourceId, '/')[4]
)

resource eventHub 'eventhubs@2024-01-01' existing = if (properties.endpointType == 'EventHub') {
name: last(split((properties.authentication.eventHubResourceId ?? '/'), '/'))
name: last(split(properties.authentication.eventHubResourceId, '/'))

resource authorizationRule 'authorizationRules@2024-01-01' existing = if (!empty(properties.authentication.?eventHubAuthorizationRuleName)) {
name: properties.authentication.?eventHubAuthorizationRuleName
Expand All @@ -46,12 +46,12 @@ resource eventHubNamespace 'Microsoft.EventHub/namespaces@2024-01-01' existing =
resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2024-01-01' existing = if (properties.endpointType == 'ServiceBus') {
name: split(properties.authentication.serviceBusNamespaceTopicResourceId, '/')[8]
scope: resourceGroup(
split((properties.authentication.serviceBusNamespaceTopicResourceId ?? '//'), '/')[2],
split((properties.authentication.serviceBusNamespaceTopicResourceId ?? '////'), '/')[4]
split(properties.authentication.serviceBusNamespaceTopicResourceId, '/')[2],
split(properties.authentication.serviceBusNamespaceTopicResourceId, '/')[4]
)

resource topic 'topics@2024-01-01' existing = if (properties.endpointType == 'ServiceBus') {
name: last(split((properties.authentication.serviceBusNamespaceTopicResourceId ?? '/'), '/'))
name: last(split(properties.authentication.serviceBusNamespaceTopicResourceId, '/'))

resource authorizationRule 'AuthorizationRules@2024-01-01' existing = if (!empty(properties.authentication.?serviceBusNamespaceTopicAuthorizationRuleName)) {
name: properties.authentication.?serviceBusNamespaceTopicAuthorizationRuleName
Expand Down
4 changes: 2 additions & 2 deletions avm/res/digital-twins/digital-twins-instance/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ module digitalTwinsInstance_privateEndpoints 'br/public:avm/res/network/private-
for (privateEndpoint, index) in (privateEndpoints ?? []): {
name: '${uniqueString(deployment().name, location)}-digitalTwinsInstance-PrivateEndpoint-${index}'
scope: resourceGroup(
split(privateEndpoint.?resourceGroupResourceId ?? privateEndpoint.?subnetResourceId, '/')[2],
split(privateEndpoint.?resourceGroupResourceId ?? privateEndpoint.?subnetResourceId, '/')[4]
split(privateEndpoint.?resourceGroupResourceId ?? resourceGroup().id, '/')[2],
split(privateEndpoint.?resourceGroupResourceId ?? resourceGroup().id, '/')[4]
)
params: {
name: privateEndpoint.?name ?? 'pep-${last(split(digitalTwinsInstance.id, '/'))}-${privateEndpoint.?service ?? 'API'}-${index}'
Expand Down

0 comments on commit b302e98

Please sign in to comment.