Skip to content

Commit

Permalink
Updated managed service
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Oct 20, 2023
1 parent 5fcd5ec commit 6a6fa90
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions modules/container-service/managed-cluster/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@ resource managedCluster 'Microsoft.ContainerService/managedClusters@2023-07-02-p
ingressProfile: {
webAppRouting: {
enabled: webApplicationRoutingEnabled
dnsZoneResourceId: !empty(dnsZoneResourceId) ? any(dnsZoneResourceId) : null
dnsZoneResourceIds: [
!empty(dnsZoneResourceId) ? any(dnsZoneResourceId) : null
]
}
}
addonProfiles: {
Expand Down Expand Up @@ -696,7 +698,7 @@ module managedCluster_roleAssignments '.bicep/nested_roleAssignments.bicep' = [f
}]

resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' existing = if (dnsZoneResourceId != null && webApplicationRoutingEnabled) {
name: last(split(dnsZoneResourceId, '/'))!
name: last(split((!empty(dnsZoneResourceId) ? dnsZoneResourceId : 'dummmyZone'), '/'))!
}

resource dnsZone_roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (enableDnsZoneContributorRoleAssignment == true && dnsZoneResourceId != null && webApplicationRoutingEnabled) {
Expand Down
10 changes: 6 additions & 4 deletions modules/container-service/managed-cluster/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "10441788183325724370"
"templateHash": "13409538219229947959"
},
"name": "Azure Kubernetes Service (AKS) Managed Clusters",
"description": "This module deploys an Azure Kubernetes Service (AKS) Managed Cluster.",
Expand Down Expand Up @@ -897,7 +897,9 @@
"ingressProfile": {
"webAppRouting": {
"enabled": "[parameters('webApplicationRoutingEnabled')]",
"dnsZoneResourceId": "[if(not(empty(parameters('dnsZoneResourceId'))), parameters('dnsZoneResourceId'), null())]"
"dnsZoneResourceIds": [
"[if(not(empty(parameters('dnsZoneResourceId'))), parameters('dnsZoneResourceId'), null())]"
]
}
},
"addonProfiles": {
Expand Down Expand Up @@ -1050,13 +1052,13 @@
"existing": true,
"type": "Microsoft.Network/dnsZones",
"apiVersion": "2018-05-01",
"name": "[last(split(parameters('dnsZoneResourceId'), '/'))]"
"name": "[last(split(if(not(empty(parameters('dnsZoneResourceId'))), parameters('dnsZoneResourceId'), 'dummmyZone'), '/'))]"
},
"dnsZone_roleAssignment": {
"condition": "[and(and(equals(parameters('enableDnsZoneContributorRoleAssignment'), true()), not(equals(parameters('dnsZoneResourceId'), null()))), parameters('webApplicationRoutingEnabled'))]",
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Network/dnsZones/{0}', last(split(parameters('dnsZoneResourceId'), '/')))]",
"scope": "[format('Microsoft.Network/dnsZones/{0}', last(split(if(not(empty(parameters('dnsZoneResourceId'))), parameters('dnsZoneResourceId'), 'dummmyZone'), '/')))]",
"name": "[guid(parameters('dnsZoneResourceId'), subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'befefa01-2a29-4197-83a8-272ff33ce314'), 'DNS Zone Contributor')]",
"properties": {
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'befefa01-2a29-4197-83a8-272ff33ce314')]",
Expand Down

0 comments on commit 6a6fa90

Please sign in to comment.