-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.bicep
99 lines (79 loc) · 3.08 KB
/
main.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
@description('Resource group location')
param rgLocation string = resourceGroup().location
@description('VNET Address Space (CIDR notation, /23 or greater)')
param vnetAddressSpace string
@description('Subnet Address Prefix (CIDR notation, /23 or greater)')
param containerAppSubnetAddressPrefix string
@description('Docker Registry URL')
param dockerRegistryUrl string
@description('Docker Registry username')
param dockerRegistryUsername string
@secure()
@description('Docker Registry password')
param dockerRegistryPassword string
@description('Public API Docker image name')
param publicApiImageName string
@description('Query API Docker image name')
param queryApiImageName string
@description('Command API Docker image name')
param commandApiImageName string
@description('Processor Docker image name')
param processorImageName string
@description('The name of the company for resource names')
param companyName string
@description('The name of the product for resource names')
param productName string
@description('The name of the region for resource names')
param regionName string
@description('The name of the region for resource names')
param environmentName string
var deploymentPrefix = '[Company].[Product].Bicep-[version]'
// Naming convention: {company}-{product}-{environment}-{region}-{component}-[identifier]
// Example: ct-blog-prod-neu-subnet-app
// Identifier is optional, to disambiguate between components.
var componentsDashedPrefix = '${companyName}-${productName}-${environmentName}-${regionName}-'
// Naming convention for resources that don't support dashes
var componentsPrefix = '${companyName}${productName}${environmentName}${regionName}'
module vnet 'Components/Networking.bicep' = {
name: '${deploymentPrefix}-Network'
params: {
rgLocation: rgLocation
vnetName: '${componentsDashedPrefix}vnet'
vnetAddressSpace: vnetAddressSpace
containerAppSubnetName: '${componentsDashedPrefix}subnet-app'
containerAppSubnetAddressPrefix: containerAppSubnetAddressPrefix
}
}
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: '${componentsDashedPrefix}law'
location: rgLocation
properties: {
sku: { name: 'PerGB2018' }
}
}
module storageAccount 'Components/Storage.bicep' = {
name: '${deploymentPrefix}Storage'
params: {
rgLocation: rgLocation
storageAccountName: '${componentsPrefix}sa'
subnetId: vnet.outputs.subnetId
}
}
module containerApps 'Components/ContainerApps.bicep' = {
name: '${deploymentPrefix}ContainerApps'
params: {
commandApiImageName: commandApiImageName
componentsDashedPrefix: componentsDashedPrefix
deploymentPrefix: deploymentPrefix
dockerRegistryPassword: dockerRegistryPassword
dockerRegistryUrl: dockerRegistryUrl
dockerRegistryUsername: dockerRegistryUsername
logAnalyticsWorkspaceName: '${componentsDashedPrefix}law'
processorImageName: processorImageName
publicApiImageName: publicApiImageName
queryApiImageName: queryApiImageName
rgLocation: rgLocation
storageAccountName: '${componentsPrefix}sa'
subnetId: vnet.outputs.subnetId
}
}