Skip to content

Commit e5b3141

Browse files
fix: Fixed issues related to intermittent WAF deployment failures
1 parent 3c25158 commit e5b3141

File tree

2 files changed

+2169
-607
lines changed

2 files changed

+2169
-607
lines changed

infra/main.bicep

Lines changed: 72 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -771,36 +771,46 @@ module avmAiServices 'modules/account/aifoundry.bicep' = {
771771
// WAF related parameters
772772
publicNetworkAccess: (enablePrivateNetworking) ? 'Disabled' : 'Enabled'
773773
//publicNetworkAccess: 'Enabled' // Always enabled for AI Services
774-
privateEndpoints: (enablePrivateNetworking && empty(existingProjectResourceId))
775-
? [
776-
{
777-
name: 'pep-aiservices-${solutionSuffix}'
778-
customNetworkInterfaceName: 'nic-aiservices-${solutionSuffix}'
779-
privateEndpointResourceId: virtualNetwork!.outputs.resourceId
780-
privateDnsZoneGroup: {
781-
privateDnsZoneGroupConfigs: [
782-
{
783-
name: 'ai-services-dns-zone-cognitiveservices'
784-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
785-
}
786-
{
787-
name: 'ai-services-dns-zone-openai'
788-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
789-
}
790-
{
791-
name: 'ai-services-dns-zone-aiservices'
792-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.aiServices]!.outputs.resourceId
793-
}
794-
{
795-
name: 'ai-services-dns-zone-contentunderstanding'
796-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.contentUnderstanding]!.outputs.resourceId
797-
}
798-
]
799-
}
800-
subnetResourceId: virtualNetwork!.outputs.backendSubnetResourceId // Use the backend subnet
801-
}
802-
]
803-
: []
774+
}
775+
}
776+
777+
module cognitiveServicePrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.8.1' = if (enablePrivateNetworking && empty(existingProjectResourceId)) {
778+
name: take('avm.res.network.private-endpoint.${solutionSuffix}', 64)
779+
params: {
780+
name: 'pep-aiservices-${solutionSuffix}'
781+
location: location
782+
tags: tags
783+
customNetworkInterfaceName: 'nic-aiservices-${solutionSuffix}'
784+
privateLinkServiceConnections: [
785+
{
786+
name: 'pep-aiservices-${solutionSuffix}-cognitiveservices-connection'
787+
properties: {
788+
privateLinkServiceId: avmAiServices.outputs.resourceId
789+
groupIds: ['account']
790+
}
791+
}
792+
]
793+
privateDnsZoneGroup: {
794+
privateDnsZoneGroupConfigs: [
795+
{
796+
name: 'ai-services-dns-zone-cognitiveservices'
797+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
798+
}
799+
{
800+
name: 'ai-services-dns-zone-openai'
801+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.openAI]!.outputs.resourceId
802+
}
803+
{
804+
name: 'ai-services-dns-zone-aiservices'
805+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.aiServices]!.outputs.resourceId
806+
}
807+
{
808+
name: 'ai-services-dns-zone-contentunderstanding'
809+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.contentUnderstanding]!.outputs.resourceId
810+
}
811+
]
812+
}
813+
subnetResourceId: virtualNetwork!.outputs.backendSubnetResourceId
804814
}
805815
}
806816

@@ -838,28 +848,38 @@ module avmAiServices_cu 'br/public:avm/res/cognitive-services/account:0.13.2' =
838848
]
839849

840850
publicNetworkAccess: (enablePrivateNetworking) ? 'Disabled' : 'Enabled'
841-
privateEndpoints: (enablePrivateNetworking)
842-
? [
843-
{
844-
name: 'pep-aicu-${solutionSuffix}'
845-
customNetworkInterfaceName: 'nic-aicu-${solutionSuffix}'
846-
privateEndpointResourceId: virtualNetwork!.outputs.resourceId
847-
privateDnsZoneGroup: {
848-
privateDnsZoneGroupConfigs: [
849-
{
850-
name: 'aicu-dns-zone-cognitiveservices'
851-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
852-
}
853-
{
854-
name: 'aicu-dns-zone-contentunderstanding'
855-
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.contentUnderstanding]!.outputs.resourceId
856-
}
857-
]
858-
}
859-
subnetResourceId: virtualNetwork!.outputs.backendSubnetResourceId // Use the backend subnet
860-
}
861-
]
862-
: []
851+
}
852+
}
853+
854+
module contentUnderstandingPrivateEndpoint 'br/public:avm/res/network/private-endpoint:0.8.1' = if (enablePrivateNetworking) {
855+
name: take('avm.res.network.private-endpoint.aicu-${solutionSuffix}', 64)
856+
params: {
857+
name: 'pep-aicu-${solutionSuffix}'
858+
location: location
859+
tags: tags
860+
customNetworkInterfaceName: 'nic-aicu-${solutionSuffix}'
861+
privateLinkServiceConnections: [
862+
{
863+
name: 'pep-aicu-${solutionSuffix}-cognitiveservices-connection'
864+
properties: {
865+
privateLinkServiceId: avmAiServices_cu.outputs.resourceId
866+
groupIds: ['account']
867+
}
868+
}
869+
]
870+
privateDnsZoneGroup: {
871+
privateDnsZoneGroupConfigs: [
872+
{
873+
name: 'aicu-dns-zone-cognitiveservices'
874+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
875+
}
876+
{
877+
name: 'aicu-dns-zone-contentunderstanding'
878+
privateDnsZoneResourceId: avmPrivateDnsZones[dnsZoneIndex.contentUnderstanding]!.outputs.resourceId
879+
}
880+
]
881+
}
882+
subnetResourceId: virtualNetwork!.outputs.backendSubnetResourceId
863883
}
864884
}
865885

0 commit comments

Comments
 (0)