Skip to content

Commit 3fef520

Browse files
author
Seth
committed
WAF - name adjustments for managed env resources
1 parent 8881730 commit 3fef520

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

infra/main.bicep

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,18 @@ module cosmosDb 'modules/cosmosDb.bicep' = {
272272
}
273273
}
274274

275+
var containerAppsEnvironmentName = 'cae-${resourcesName}${enablePrivateNetworking ? '-frontend' : ''}'
276+
275277
module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.11.2' = {
276278
name: take('container-env-${resourcesName}-deployment', 64)
277279
#disable-next-line no-unnecessary-dependson
278280
dependsOn: [applicationInsights, logAnalyticsWorkspace, network] // required due to optional flags that could change dependency
279281
params: {
280-
name: 'cae-${resourcesName}${enablePrivateNetworking ? '-frontend' : ''}'
282+
name: containerAppsEnvironmentName
283+
infrastructureResourceGroupName: '${resourceGroup().name}-ME-${containerAppsEnvironmentName}'
281284
location: location
282285
zoneRedundant: enableRedundancy && enablePrivateNetworking
283-
publicNetworkAccess: 'Enabled'
286+
publicNetworkAccess: 'Enabled' // public access required for frontend (and backend if private networking is not enabled)
284287
infrastructureSubnetResourceId: enablePrivateNetworking ? first(filter(network.outputs.subnets, s => s.name == 'web')).resourceId : null
285288
managedIdentities: {
286289
userAssignedResourceIds: [
@@ -333,7 +336,7 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.16.0' = {
333336
}
334337
]
335338
ingressTargetPort: 3000
336-
ingressExternal: true
339+
ingressExternal: true // public access required for frontend
337340
scaleSettings: {
338341
maxReplicas: enableScaling ? 3 : 1
339342
minReplicas: 1
@@ -352,15 +355,18 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.16.0' = {
352355
}
353356
}
354357

358+
var containerAppsEnvironmentBackendName = 'cae-${resourcesName}-backend'
359+
355360
module containerAppsEnvironmentBackend 'br/public:avm/res/app/managed-environment:0.11.2' = if (enablePrivateNetworking) {
356361
name: take('container-env-backend-${resourcesName}-deployment', 64)
357362
#disable-next-line no-unnecessary-dependson
358363
dependsOn: [applicationInsights, logAnalyticsWorkspace] // required due to optional flags that could change dependency
359364
params: {
360-
name: 'cae-${resourcesName}-backend'
365+
name: containerAppsEnvironmentBackendName
366+
infrastructureResourceGroupName: '${resourceGroup().name}-ME-${containerAppsEnvironmentBackendName}'
361367
location: location
362368
zoneRedundant: enableRedundancy
363-
publicNetworkAccess: 'Disabled' // 'Enabled' or 'Disabled', both tested. Container deployed in both cases.
369+
publicNetworkAccess: 'Disabled' // public access denied for backend
364370
infrastructureSubnetResourceId: first(filter(network.outputs.subnets, s => s.name == 'app')).resourceId
365371
managedIdentities: {
366372
userAssignedResourceIds: [

0 commit comments

Comments
 (0)