-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtemplate.bicep
109 lines (88 loc) · 2.93 KB
/
template.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
/*
Deploy infrastructure for Azure monitoring with Log Analytics
*/
// === PARAMETERS ===
@description('The organization name')
@minLength(3)
@maxLength(3)
param organizationName string
@description('The application name')
@minLength(2)
@maxLength(14)
param applicationName string
@description('The host name of the deployment stage')
@minLength(3)
@maxLength(5)
param hostName string
@description('The azure-templates version')
@minLength(1)
param templateVersion string
@description('The pricing plan')
@allowed([
'Free' // The cheapest plan, can create some small fees
'Basic' // Basic use with default limitations
])
param pricingPlan string = 'Free'
@description('Whether to deploy reporting workbooks')
param deployWorkbooks bool = false
@description('The deployment location')
param location string = resourceGroup().location
// === VARIABLES ===
@description('The region name')
var regionName = loadJsonContent('../modules/global/regions.json')[location].name
@description('Global & naming conventions')
var conventions = json(replace(replace(replace(replace(loadTextContent('../modules/global/conventions.json'), '%ORGANIZATION%', organizationName), '%APPLICATION%', applicationName), '%HOST%', hostName), '%REGION%', regionName))
// === RESOURCES ===
@description('Resource groupe tags')
module tags '../modules/global/tags.bicep' = {
name: 'Resource-Tags'
params: {
organizationName: organizationName
applicationName: applicationName
hostName: hostName
regionName: regionName
templateVersion: templateVersion
}
}
@description('Log Analytics Workspace')
module workspace '../modules/monitoring/log-analytics-workspace.bicep' = {
name: 'Resource-LogAnalyticsWorkspace'
params: {
referential: tags.outputs.referential
conventions: conventions
location: location
pricingPlan: pricingPlan
}
}
@description('Monitor Workbook - Applications')
module workbook_applications '../modules/monitoring/workbooks/applications.bicep' = if (deployWorkbooks) {
name: 'Resource-MonitorWorkbook-Applications'
params: {
referential: tags.outputs.referential
conventions: conventions
location: location
}
}
@description('Monitor Workbook - Costs')
module workbook_costs '../modules/monitoring/workbooks/costs.bicep' = if (deployWorkbooks) {
name: 'Resource-MonitorWorkbook-Costs'
params: {
referential: tags.outputs.referential
conventions: conventions
location: location
}
}
@description('Monitor Workbook - Resources')
module workbook_resources '../modules/monitoring/workbooks/resources.bicep' = if (deployWorkbooks) {
name: 'Resource-MonitorWorkbook-Resources'
params: {
referential: tags.outputs.referential
conventions: conventions
location: location
}
}
// === OUTPUTS ===
@description('The ID of the deployed resource')
output resourceId string = workspace.outputs.id
@description('The Name of the deployed resource')
output resourceName string = workspace.outputs.name