Azdev-ify changes for latest /bicep/core
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
param environmentName string
|
||||
param name string
|
||||
param location string = resourceGroup().location
|
||||
param tags object = {}
|
||||
|
||||
param containerAppsEnvironmentName string = ''
|
||||
param containerName string = 'main'
|
||||
param containerRegistryName string = ''
|
||||
param env array = []
|
||||
param external bool = true
|
||||
param imageName string
|
||||
param keyVaultName string = ''
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param managedIdentity bool = !empty(keyVaultName)
|
||||
param targetPort int = 80
|
||||
param serviceName string
|
||||
|
||||
var abbrs = loadJsonContent('../../abbreviations.json')
|
||||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
|
||||
var tags = { 'azd-env-name': environmentName }
|
||||
@description('CPU cores allocated to a single container instance, e.g. 0.5')
|
||||
param containerCpuCoreCount string = '0.5'
|
||||
|
||||
@description('Memory allocated to a single container instance, e.g. 1Gi')
|
||||
param containerMemory string = '1.0Gi'
|
||||
|
||||
resource app 'Microsoft.App/containerApps@2022-03-01' = {
|
||||
name: '${abbrs.appContainerApps}${serviceName}-${resourceToken}'
|
||||
name: name
|
||||
location: location
|
||||
tags: union(tags, { 'azd-service-name': serviceName })
|
||||
identity: managedIdentity ? { type: 'SystemAssigned' } : null
|
||||
tags: tags
|
||||
identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }
|
||||
properties: {
|
||||
managedEnvironmentId: containerAppsEnvironment.id
|
||||
configuration: {
|
||||
@@ -47,33 +50,28 @@ resource app 'Microsoft.App/containerApps@2022-03-01' = {
|
||||
containers: [
|
||||
{
|
||||
image: imageName
|
||||
name: 'main'
|
||||
name: containerName
|
||||
env: env
|
||||
resources: {
|
||||
cpu: json(containerCpuCoreCount)
|
||||
memory: containerMemory
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module keyVaultAccess '../security/keyvault-access.bicep' = if (!(empty(keyVaultName))) {
|
||||
name: '${serviceName}-appservice-keyvault-access'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
keyVaultName: keyVaultName
|
||||
principalId: app.identity.principalId
|
||||
}
|
||||
}
|
||||
|
||||
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-03-01' existing = {
|
||||
name: !empty(containerAppsEnvironmentName) ? containerAppsEnvironmentName : '${abbrs.appManagedEnvironments}${resourceToken}'
|
||||
name: containerAppsEnvironmentName
|
||||
}
|
||||
|
||||
// 2022-02-01-preview needed for anonymousPullEnabled
|
||||
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2022-02-01-preview' existing = {
|
||||
name: !empty(containerRegistryName) ? containerRegistryName : '${abbrs.containerRegistryRegistries}${resourceToken}'
|
||||
name: containerRegistryName
|
||||
}
|
||||
|
||||
output identityPrincipalId string = managedIdentity ? app.identity.principalId : ''
|
||||
output imageName string = imageName
|
||||
output name string = app.name
|
||||
output uri string = 'https://${app.properties.configuration.ingress.fqdn}'
|
||||
|
||||
Reference in New Issue
Block a user