-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.bicep
74 lines (66 loc) · 1.9 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
targetScope = 'subscription'
@description('The name of environment (dev, prod, ...)')
param environment string = 'dev'
@description('The name of your search service. This value should be unique')
param applicationName string = 'meilisearch'
@description('The Azure region code.')
param location string = 'eastus'
@secure()
@description('The API Key used to connect to your Meilisearch instance.')
param meilisearch_apikey string = newGuid()
var instanceNumber = '001'
var shareName = 'meilisearch'
var defaultTags = {
'environment': environment
'application': applicationName
}
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: 'rg-${applicationName}-${instanceNumber}'
location: location
tags: defaultTags
}
module storage 'modules/storage/storage.bicep' = {
name: 'storage'
scope: resourceGroup(rg.name)
params: {
location: location
applicationName: applicationName
environment: environment
resourceTags: defaultTags
instanceNumber: instanceNumber
}
}
module fileShare 'modules/storage/file-share.bicep'= {
name: 'fileShare'
scope: resourceGroup(rg.name)
params: {
parentStorageAccountName: storage.outputs.storageAccountName
shareName: shareName
}
}
module webApp 'modules/app-service/app-service.bicep' = {
name: 'webApp'
scope: resourceGroup(rg.name)
params: {
location: location
applicationName: applicationName
environment: environment
resourceTags: defaultTags
instanceNumber: instanceNumber
shareName: shareName
shareStorageName: storage.outputs.storageAccountName
shareMountPath: '/data/meili'
environmentVariables: [
{
name: 'MEILI_MASTER_KEY'
value: meilisearch_apikey
}
{
name: 'MEILI_DB_PATH'
value: '/data/meili'
}
]
}
}
output MeilisearchApiUrl string = webApp.outputs.application_hostname
output MeilisearchResourceGroup string = rg.name