This repository was archived by the owner on Jul 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvariables.tf
More file actions
412 lines (376 loc) · 13.7 KB
/
variables.tf
File metadata and controls
412 lines (376 loc) · 13.7 KB
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
variable "AUDIT_BACKEND_AZURE_STORAGE_ACCOUNT_NAME" {
description = "The name of the Azure Storage Account for the audit backend"
type = string
}
variable "AUDIT_BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME" {
description = "The name of the container in the Audit Azure Storage Account for the backend"
type = string
}
variable "AUDIT_BACKEND_AZURE_RESOURCE_GROUP_NAME" {
description = "The name of the audit resource group for the Azure Storage Account"
type = string
}
variable "AUDIT_BACKEND_AZURE_STORAGE_ACCOUNT_KEY" {
description = "The name of the audit resource group for the Azure Storage Account"
type = string
}
variable "TARGET_SUBSCRIPTION_ID" {
description = "ID of a subscription to deploy infrastructure"
type = string
}
variable "AUDIT_SUBSCRIPTION_ID" {
description = "ID of the Audit subscription to deploy infrastructure"
type = string
}
variable "HUB_SUBSCRIPTION_ID" {
description = "ID of the subscription hosting the DevOps resources"
type = string
}
variable "HUB_BACKEND_AZURE_STORAGE_ACCOUNT_NAME" {
description = "The name of the Azure Storage Account for the backend"
type = string
}
variable "HUB_BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME" {
description = "The name of the container in the Azure Storage Account for the backend"
type = string
}
variable "HUB_BACKEND_AZURE_STORAGE_ACCOUNT_KEY" {
description = "The name of the Statefile for the hub resources"
type = string
}
variable "HUB_BACKEND_AZURE_RESOURCE_GROUP_NAME" {
description = "The name of the resource group for the Azure Storage Account"
type = string
}
variable "application" {
description = "Project/Application code for deployment"
type = string
default = "DToS"
}
variable "application_full_name" {
description = "Full name of the Project/Application code for deployment"
type = string
default = "DToS"
}
variable "app_service_plan" {
description = "Configuration for the app service plan"
type = object({
sku_name = optional(string, "P2v3")
os_type = optional(string, "Linux")
vnet_integration_enabled = optional(bool, false)
autoscale = object({
scaling_rule = object({
metric = optional(string)
capacity_min = optional(string)
capacity_max = optional(string)
capacity_def = optional(string)
time_grain = optional(string)
statistic = optional(string)
time_window = optional(string)
time_aggregation = optional(string)
inc_operator = optional(string)
inc_threshold = optional(number)
inc_scale_direction = optional(string)
inc_scale_type = optional(string)
inc_scale_value = optional(number)
inc_scale_cooldown = optional(string)
dec_operator = optional(string)
dec_threshold = optional(number)
dec_scale_direction = optional(string)
dec_scale_type = optional(string)
dec_scale_value = optional(number)
dec_scale_cooldown = optional(string)
})
})
instances = map(object({
autoscale_override = optional(object({
scaling_rule = object({
metric = optional(string)
capacity_min = optional(string)
capacity_max = optional(string)
capacity_def = optional(string)
time_grain = optional(string)
statistic = optional(string)
time_window = optional(string)
time_aggregation = optional(string)
inc_operator = optional(string)
inc_threshold = optional(number)
inc_scale_direction = optional(string)
inc_scale_type = optional(string)
inc_scale_value = optional(number)
inc_scale_cooldown = optional(string)
dec_operator = optional(string)
dec_threshold = optional(number)
dec_scale_direction = optional(string)
dec_scale_type = optional(string)
dec_scale_value = optional(number)
dec_scale_cooldown = optional(string)
})
}))
wildcard_ssl_cert_key = optional(string, null)
}))
})
}
variable "diagnostic_settings" {
description = "Configuration for the diagnostic settings"
type = object({
metric_enabled = optional(bool, false)
})
}
variable "environment" {
description = "Environment code for deployments"
type = string
default = "DEV"
}
variable "features" {
description = "Feature flags for the deployment"
type = map(bool)
}
variable "function_apps" {
description = "Configuration for function apps"
type = object({
always_on = bool
app_service_logs_disk_quota_mb = optional(number)
app_service_logs_retention_period_days = optional(number)
cont_registry_use_mi = bool
docker_env_tag = string
docker_img_prefix = string
enable_appsrv_storage = bool
ftps_state = string
health_check_path = optional(string)
https_only = bool
ip_restriction_default_action = optional(string, "Deny")
remote_debugging_enabled = bool
storage_uses_managed_identity = bool
worker_32bit = bool
slots = optional(map(object({
name = string
slot_enabled = optional(bool, false)
})))
function_app_config = map(object({
name_suffix = string
function_endpoint_name = string
app_service_plan_key = string
storage_account_env_var_name = optional(string, "")
storage_containers = optional(list(object
({
env_var_name = string
container_name = string
})), [])
db_connection_string = optional(string, "")
azuread_group_id = optional(list(string))
event_grid_topic_producer = optional(string, "")
key_vault_url = optional(string, "")
env_vars = optional(object({
static = optional(map(string), {})
from_key_vault = optional(map(string), {})
local_urls = optional(map(string), {})
}), {})
ip_restrictions = optional(map(object({
headers = optional(list(object({
x_azure_fdid = optional(list(string))
x_fd_health_probe = optional(list(string))
x_forwarded_for = optional(list(string))
x_forwarded_host = optional(list(string))
})), [])
ip_address = optional(string)
name = optional(string)
priority = optional(number)
action = optional(string)
service_tag = optional(string)
virtual_network_subnet_id = optional(string)
})), {})
}))
})
}
variable "function_app_slots" {
description = "function app slots"
type = list(object({
function_app_slots_name = optional(string, "staging")
function_app_slot_enabled = optional(bool, false)
}))
}
variable "image_commit_hash" {
description = "The commit SHA of the Docker image generated by the CI pipeline and applied to all functions"
type = string
}
variable "key_vault" {
description = "Configuration for the key vault"
type = object({
disk_encryption = optional(bool, true)
soft_del_ret_days = optional(number, 7)
purge_prot = optional(bool, false)
sku_name = optional(string, "standard")
})
}
variable "network_security_group_rules" {
description = "The network security group rules."
default = {}
type = map(list(object({
name = string
priority = number
direction = string
access = string
protocol = string
source_port_range = string
destination_port_range = string
source_address_prefix = string
destination_address_prefix = string
})))
}
/*
application_rule_collection = [
{
name = "example-application-rule-collection-1"
priority = 600
action = "Allow"
rule_name = "example-rule-1"
protocols = [
{
type = "Http"
port = 80
},
{
type = "Https"
port = 443
}
]
source_addresses = ["0.0.0.0/0"]
destination_fqdns = ["example.com"]
},
]
*/
variable "regions" {
type = map(object({
address_space = optional(string)
is_primary_region = bool
connect_peering = optional(bool, false)
subnets = optional(map(object({
cidr_newbits = string
cidr_offset = string
create_nsg = optional(bool, true) # defaults to true
name = optional(string) # Optional name override
delegation_name = optional(string)
service_delegation_name = optional(string)
service_delegation_actions = optional(list(string))
})))
}))
}
variable "registry_host" {
description = "The URL of the container registry used by the CI pipeline. Default = <GitHub URL>"
type = string
default = "https://ghcr.io/nhsdigital"
}
variable "routes" {
description = "Routes configuration for different regions"
type = map(object({
bgp_route_propagation_enabled = optional(bool, false)
firewall_policy_priority = number
application_rules = list(object({
name = optional(string)
priority = optional(number)
action = optional(string)
rule_name = optional(string)
protocols = list(object({
type = optional(string)
port = optional(number)
}))
source_addresses = optional(list(string))
destination_fqdns = list(string)
}))
nat_rules = list(object({
name = optional(string)
priority = optional(number)
action = optional(string)
rule_name = optional(string)
protocols = list(string)
source_addresses = list(string)
destination_address = optional(string)
destination_ports = list(string)
translated_address = optional(string)
translated_port = optional(string)
}))
network_rules = list(object({
name = optional(string)
priority = optional(number)
action = optional(string)
rule_name = optional(string)
source_addresses = optional(list(string))
destination_addresses = optional(list(string))
protocols = optional(list(string))
destination_ports = optional(list(string))
}))
route_table_routes_to_audit = list(object({
name = optional(string)
address_prefix = optional(string)
next_hop_type = optional(string)
next_hop_in_ip_address = optional(string)
}))
route_table_routes_from_audit = list(object({
name = optional(string)
address_prefix = optional(string)
next_hop_type = optional(string)
next_hop_in_ip_address = optional(string)
}))
}))
default = {}
}
variable "sqlserver" {
description = "Configuration for the Azure MSSQL server instance and a default database "
type = object({
sql_uai_name = optional(string)
sql_admin_group_name = optional(string)
ad_auth_only = optional(bool)
auditing_policy_retention_in_days = optional(number)
security_alert_policy_retention_days = optional(number)
# Server Instance
server = optional(object({
sqlversion = optional(string, "12.0")
tlsversion = optional(number, 1.2)
azure_services_access_enabled = optional(bool, true)
}), {})
# Database
dbs = optional(map(object({
db_name_suffix = optional(string, "svclyr")
collation = optional(string, "SQL_Latin1_General_CP1_CI_AS")
licence_type = optional(string, "LicenseIncluded")
max_gb = optional(number, 5)
read_scale = optional(bool, false)
sku = optional(string, "S0")
})), {})
# FW Rules
fw_rules = optional(map(object({
fw_rule_name = string
start_ip = string
end_ip = string
})), {})
})
}
variable "storage_accounts" {
description = "Configuration for the Storage Account, currently used for Function Apps"
type = map(object({
name_suffix = string
account_tier = optional(string, "Standard")
replication_type = optional(string, "LRS")
public_network_access_enabled = optional(bool, false)
containers = optional(map(object({
container_name = string
container_access_type = optional(string, "private")
})), {})
queues = optional(list(string))
}))
}
variable "tags" {
description = "Default tags to be applied to resources"
type = map(string)
}
variable "wildcard_ssl_cert_key_vault_secret_id" {
type = string
description = "Wildcard SSL certificate Key Vault secret id, for App Services Custom Domain binding."
default = null
}
variable "wildcard_ssl_cert_key_vault_id" {
type = string
description = "Wildcard SSL certificate Key Vault id, needed if the Key Vault is in a different subscription."
default = null
}