-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontainer-apps-environment.bicep
117 lines (109 loc) · 4.19 KB
/
container-apps-environment.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
@description('Name of the resource.')
param name string
@description('Location to deploy the resource. Defaults to the location of the resource group.')
param location string = resourceGroup().location
@description('Tags for the resource.')
param tags object = {}
@export()
@description('Information about a workload profile for the environment.')
type workloadProfileInfo = {
@description('Friendly name of the workload profile.')
name: string
@description('Type of the workload profile.')
workloadProfileType:
| 'D4'
| 'D8'
| 'D16'
| 'D32'
| 'E4'
| 'E8'
| 'E16'
| 'E32'
| 'NC24-A100'
| 'NC48-A100'
| 'NC96-A100'
@description('Minimum number of nodes for the workload profile.')
minimumCount: int
@description('Maximum number of nodes for the workload profile.')
maximumCount: int
}
@export()
@description('Information about the configuration for a custom domain in the environment.')
type customDomainConfigInfo = {
@description('Name of the custom domain.')
dnsSuffix: string
@description('Value of the custom domain certificate.')
certificateValue: string
@description('Password for the custom domain certificate.')
certificatePassword: string
}
@export()
@description('Information about the configuration for a virtual network in the environment.')
type vnetConfigInfo = {
@description('Resource ID of a subnet for infrastructure components.')
infrastructureSubnetId: string
@description('Value indicating whether the environment only has an internal load balancer.')
internal: bool
}
@description('Additional workload profiles. Includes Consumption by default.')
param workloadProfiles workloadProfileInfo[] = []
@description('Name of the Log Analytics Workspace to store application logs.')
param logAnalyticsWorkspaceName string
@description('Name of the Application Insights resource.')
param applicationInsightsName string
@description('Custom domain configuration for the environment.')
param customDomainConfig customDomainConfigInfo = {
dnsSuffix: ''
certificateValue: ''
certificatePassword: ''
}
@description('Virtual network configuration for the environment.')
param vnetConfig vnetConfigInfo = {
infrastructureSubnetId: ''
internal: true
}
@description('Value indicating whether the environment is zone-redundant. Defaults to false.')
param zoneRedundant bool = false
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' existing = {
name: logAnalyticsWorkspaceName
}
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = {
name: applicationInsightsName
}
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2024-03-01' = {
name: name
location: location
tags: tags
properties: {
appLogsConfiguration: {
destination: 'log-analytics'
logAnalyticsConfiguration: {
customerId: logAnalyticsWorkspace.properties.customerId
sharedKey: logAnalyticsWorkspace.listKeys().primarySharedKey
}
}
workloadProfiles: concat(
[
{
name: 'Consumption'
workloadProfileType: 'Consumption'
}
],
workloadProfiles
)
customDomainConfiguration: !empty(customDomainConfig.dnsSuffix) ? customDomainConfig : {}
vnetConfiguration: !empty(vnetConfig.infrastructureSubnetId) ? vnetConfig : {}
zoneRedundant: zoneRedundant
daprAIConnectionString: applicationInsights.properties.ConnectionString
}
}
@description('The deployed Container Apps Environment resource.')
output resource resource = containerAppsEnvironment
@description('ID for the deployed Container Apps Environment resource.')
output id string = containerAppsEnvironment.id
@description('Name for the deployed Container Apps Environment resource.')
output name string = containerAppsEnvironment.name
@description('Default domain for the deployed Container Apps Environment resource.')
output defaultDomain string = containerAppsEnvironment.properties.defaultDomain
@description('Static IP for the deployed Container Apps Environment resource.')
output staticIp string = containerAppsEnvironment.properties.staticIp