-
Notifications
You must be signed in to change notification settings - Fork 16
/
vsp.json
184 lines (181 loc) · 7.47 KB
/
vsp.json
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"gitCommitHash": {
"type": "string"
},
"appServicePlanName": {
"type": "string"
},
"appServicePlanSkuTier": {
"type": "string"
},
"appServicePlanSkuSize": {
"type": "string"
},
"appServicePlanSkuFamily": {
"type": "string"
},
"appServicePlanSkuCapacity": {
"type": "int"
},
"appServiceName": {
"type": "string"
},
"appServiceRuntimeStack": {
"type": "string"
},
"appServiceAlwaysOn": {
"type": "bool"
},
"appServiceAllowedIpAddresses": {
"type": "array"
},
"appServiceEnvironmentVariables": {
"type": "array",
"defaultValue": []
},
"enableLogs": {
"type": "bool",
"defaultValue": true
}
},
"variables": {
"platformBuildingBlocksDeploymentUrlBase": "https://raw.githubusercontent.com/DFE-Digital/bat-platform-building-blocks/7a4748a0cf366193d31434bd7796d483bd281385/templates/",
"deploymentUrlBase": "[concat('https://raw.githubusercontent.com/DFE-Digital/dfe-teachers-payment-service/', parameters('gitCommitHash'), '/azure/templates/')]",
"appServiceLogsDeploymentName": "[concat(deployment().name, '-app-service-logs')]",
"appServicePlanDeploymentName": "[concat(deployment().name, '-app-service-plan')]",
"appServiceAllowedIpAddressCount": "[length(parameters('appServiceAllowedIpAddresses'))]",
"appServiceStagingSlotName": "[concat(parameters('appServiceName'), '/staging')]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "[variables('appServicePlanDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(variables('deploymentUrlBase'), 'app_service_plan.json')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"appServicePlanName": {
"value": "[parameters('appServicePlanName')]"
},
"appServicePlanSkuTier": {
"value": "[parameters('appServicePlanSkuTier')]"
},
"appServicePlanSkuSize": {
"value": "[parameters('appServicePlanSkuSize')]"
},
"appServicePlanSkuFamily": {
"value": "[parameters('appServicePlanSkuFamily')]"
},
"appServicePlanSkuCapacity": {
"value": "[parameters('appServicePlanSkuCapacity')]"
}
}
}
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[parameters('appServiceName')]",
"kind": "app,linux,container",
"location": "[resourceGroup().location]",
"dependsOn": ["[resourceId('Microsoft.Resources/deployments', variables('appServicePlanDeploymentName'))]"],
"properties": {
"httpsOnly": true,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]",
"siteConfig": {
"alwaysOn": "[parameters('appServiceAlwaysOn')]",
"appSettings": "[parameters('appServiceEnvironmentVariables')]",
"copy": [
{
"name": "ipSecurityRestrictions",
"count": "[add(variables('appServiceAllowedIpAddressCount'), 1)]",
"input": {
"ipAddress": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), if(contains(parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')], '/'), parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')], concat(parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')], '/32')), '0.0.0.0/1')]",
"action": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), 'Allow', 'Deny')]",
"priority": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), 65000, 2147483647)]",
"name": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), concat('Allow ', parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')]), 'Deny all')]"
}
}
]
}
}
},
{
"type": "Microsoft.Web/sites/slots",
"apiVersion": "2018-11-01",
"name": "[variables('appServiceStagingSlotName')]",
"location": "[resourceGroup().location]",
"dependsOn": ["[resourceId('Microsoft.Web/sites', parameters('appServiceName'))]"],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]",
"httpsOnly": true,
"siteConfig": {
"alwaysOn": false,
"linuxFxVersion": "[parameters('appServiceRuntimeStack')]",
"appSettings": "[parameters('appServiceEnvironmentVariables')]",
"copy": [
{
"name": "ipSecurityRestrictions",
"count": "[add(variables('appServiceAllowedIpAddressCount'), 1)]",
"input": {
"ipAddress": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), if(contains(parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')], '/'), parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')], concat(parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')], '/32')), '0.0.0.0/1')]",
"action": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), 'Allow', 'Deny')]",
"priority": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), 65000, 2147483647)]",
"name": "[if(less(copyIndex('ipSecurityRestrictions'), variables('appServiceAllowedIpAddressCount')), concat('Allow ', parameters('appServiceAllowedIpAddresses')[copyIndex('ipSecurityRestrictions')]), 'Deny all')]"
}
}
]
}
}
},
{
"condition": "[parameters('enableLogs')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-05-10",
"name": "[variables('appServiceLogsDeploymentName')]",
"dependsOn": ["[resourceId('Microsoft.Web/sites', parameters('appServiceName'))]"],
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(variables('platformBuildingBlocksDeploymentUrlBase'), 'app-service-logs.json')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"appServiceName": {
"value": "[parameters('appServiceName')]"
},
"httpLoggingEnabled": {
"value": true
},
"requestTracingEnabled": {
"value": true
},
"detailedErrorLoggingEnabled": {
"value": true
}
}
}
}
],
"outputs": {
"appServicePlanId": {
"type": "string",
"value": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]"
},
"appServiceId": {
"type": "string",
"value": "[resourceId('Microsoft.Web/sites', parameters('appServiceName'))]"
},
"appServiceHostName": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Web/sites', parameters('appServiceName'))).defaultHostName]"
}
}
}