-
Notifications
You must be signed in to change notification settings - Fork 53
/
main.bicep
109 lines (104 loc) · 3.42 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
100
101
102
103
104
105
106
107
108
109
@sys.description('The environment type (nonprod or prod)')
@allowed([
'nonprod'
'prod'
])
param environmentType string = 'nonprod'
@sys.description('The PostgreSQL Server name')
@minLength(3)
@maxLength(24)
param postgreSQLServerName string = 'ie-bank-db-server-dev'
@sys.description('The PostgreSQL Database name')
@minLength(3)
@maxLength(24)
param postgreSQLDatabaseName string = 'ie-bank-db'
@sys.description('The App Service Plan name')
@minLength(3)
@maxLength(24)
param appServicePlanName string = 'ie-bank-app-sp-dev'
@sys.description('The Web App name (frontend)')
@minLength(3)
@maxLength(24)
param appServiceAppName string = 'ie-bank-dev'
@sys.description('The API App name (backend)')
@minLength(3)
@maxLength(24)
param appServiceAPIAppName string = 'ie-bank-api-dev'
@sys.description('The Azure location where the resources will be deployed')
param location string = resourceGroup().location
@sys.description('The value for the environment variable ENV')
param appServiceAPIEnvVarENV string
@sys.description('The value for the environment variable DBHOST')
param appServiceAPIEnvVarDBHOST string
@sys.description('The value for the environment variable DBNAME')
param appServiceAPIEnvVarDBNAME string
@sys.description('The value for the environment variable DBPASS')
@secure()
param appServiceAPIEnvVarDBPASS string
@sys.description('The value for the environment variable DBUSER')
param appServiceAPIDBHostDBUSER string
@sys.description('The value for the environment variable FLASK_APP')
param appServiceAPIDBHostFLASK_APP string
@sys.description('The value for the environment variable FLASK_DEBUG')
param appServiceAPIDBHostFLASK_DEBUG string
resource postgresSQLServer 'Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01' = {
name: postgreSQLServerName
location: location
sku: {
name: 'Standard_B1ms'
tier: 'Burstable'
}
properties: {
administratorLogin: 'iebankdbadmin'
administratorLoginPassword: 'IE.Bank.DB.Admin.Pa$$'
createMode: 'Default'
highAvailability: {
mode: 'Disabled'
standbyAvailabilityZone: ''
}
storage: {
storageSizeGB: 32
}
backup: {
backupRetentionDays: 7
geoRedundantBackup: 'Disabled'
}
version: '15'
}
resource postgresSQLServerFirewallRules 'firewallRules@2022-12-01' = {
name: 'AllowAllAzureServicesAndResourcesWithinAzureIps'
properties: {
endIpAddress: '0.0.0.0'
startIpAddress: '0.0.0.0'
}
}
}
resource postgresSQLDatabase 'Microsoft.DBforPostgreSQL/flexibleServers/databases@2022-12-01' = {
name: postgreSQLDatabaseName
parent: postgresSQLServer
properties: {
charset: 'UTF8'
collation: 'en_US.UTF8'
}
}
module appService 'modules/app-service.bicep' = {
name: 'appService'
params: {
location: location
environmentType: environmentType
appServiceAppName: appServiceAppName
appServiceAPIAppName: appServiceAPIAppName
appServicePlanName: appServicePlanName
appServiceAPIDBHostDBUSER: appServiceAPIDBHostDBUSER
appServiceAPIDBHostFLASK_APP: appServiceAPIDBHostFLASK_APP
appServiceAPIDBHostFLASK_DEBUG: appServiceAPIDBHostFLASK_DEBUG
appServiceAPIEnvVarDBHOST: appServiceAPIEnvVarDBHOST
appServiceAPIEnvVarDBNAME: appServiceAPIEnvVarDBNAME
appServiceAPIEnvVarDBPASS: appServiceAPIEnvVarDBPASS
appServiceAPIEnvVarENV: appServiceAPIEnvVarENV
}
dependsOn: [
postgresSQLDatabase
]
}
output appServiceAppHostName string = appService.outputs.appServiceAppHostName