-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
413 lines (362 loc) · 12.8 KB
/
Copy pathvariables.tf
File metadata and controls
413 lines (362 loc) · 12.8 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
413
##-----------------------------------------------------------------------------
## Naming Convention
##-----------------------------------------------------------------------------
variable "custom_name" {
type = string
default = null
description = "Override the base name produced by the standard labels module."
}
variable "custom_dev_center_name" {
type = string
default = null
description = "Override the generated Dev Center resource name."
}
variable "custom_dev_center_project_name" {
type = string
default = null
description = "Override the generated Dev Center Project resource name."
}
variable "custom_managed_devops_pool_name" {
type = string
default = null
description = "Override the generated Managed DevOps Pool resource name."
}
variable "resource_position_prefix" {
type = bool
default = true
description = <<EOT
Controls the placement of the resource type keyword in generated resource names.
- If true, the keyword is prepended, for example: mdp-core-dev-centralus.
- If false, the keyword is appended, for example: core-dev-centralus-mdp.
EOT
}
##-----------------------------------------------------------------------------
## Labels
##-----------------------------------------------------------------------------
variable "name" {
type = string
default = ""
description = "Name, for example app, platform or mxcore."
}
variable "environment" {
type = string
default = ""
description = "Environment, for example prod, dev, staging or shared."
}
variable "managedby" {
type = string
default = "terraform-az-modules"
description = "ManagedBy tag value."
}
variable "extra_tags" {
type = map(string)
default = null
description = "Additional tags to merge with the standard tags."
}
variable "repository" {
type = string
default = "https://github.com/terraform-az-modules/terraform-azurerm-managed-devops-pool"
description = "Terraform module repository URL used in resource tags."
validation {
condition = can(regex("^https://", var.repository))
error_message = "repository must be a valid HTTPS URL."
}
}
variable "location" {
type = string
description = "Azure region where the Dev Center, Project and Managed DevOps Pool are created."
}
variable "deployment_mode" {
type = string
default = "terraform"
description = "Specifies how the infrastructure is deployed."
}
variable "label_order" {
type = list(any)
default = ["name", "environment", "location"]
description = "Order of labels used to construct names and tags."
}
##-----------------------------------------------------------------------------
## Global Variables
##-----------------------------------------------------------------------------
variable "resource_group_name" {
type = string
description = "Name of the standard resource group in which resources are created. Do not use an Azure-managed resource group protected by a deny assignment."
}
variable "enable" {
type = bool
default = true
description = "Set to false to prevent the module from creating resources."
}
##-----------------------------------------------------------------------------
## Dev Center
##-----------------------------------------------------------------------------
variable "create_dev_center" {
type = bool
default = true
description = "Create a Dev Center. Set to false to use dev_center_id."
}
variable "dev_center_id" {
type = string
default = null
description = "Existing Dev Center ID. Required when creating a project without creating a Dev Center."
}
variable "project_catalog_item_sync_enabled" {
type = bool
default = false
description = "Whether project catalogs associated with the Dev Center can synchronize catalog items."
}
variable "dev_center_identity" {
type = object({
type = string
identity_ids = optional(list(string), [])
})
default = null
description = "Optional managed identity configuration for the Dev Center."
}
##-----------------------------------------------------------------------------
## Dev Center Project
##-----------------------------------------------------------------------------
variable "create_dev_center_project" {
type = bool
default = true
description = "Create a Dev Center Project. Set to false to use dev_center_project_id."
}
variable "dev_center_project_id" {
type = string
default = null
description = "Existing Dev Center Project ID. Required when create_dev_center_project is false."
}
variable "dev_center_project_description" {
type = string
default = "Managed DevOps Pool project managed by Terraform."
description = "Description assigned to the Dev Center Project."
}
variable "maximum_dev_boxes_per_user" {
type = number
default = null
description = "Optional maximum number of Dev Boxes each user can create across the project."
}
variable "dev_center_project_identity" {
type = object({
type = string
identity_ids = optional(list(string), [])
})
default = null
description = "Optional managed identity configuration for the Dev Center Project."
}
##-----------------------------------------------------------------------------
## Azure DevOps Organization Configuration
##-----------------------------------------------------------------------------
variable "azure_devops_organizations" {
type = list(object({
url = string
parallelism = number
projects = optional(list(string))
}))
description = "Azure DevOps organizations to connect to the pool. The parallelism total must equal maximum_concurrency."
validation {
condition = alltrue([
for organization in var.azure_devops_organizations :
organization.parallelism >= 1 && organization.parallelism <= 10000
])
error_message = "Each organization parallelism value must be between 1 and 10000."
}
}
variable "azure_devops_permission" {
type = object({
kind = string
administrator_account = optional(object({
groups = optional(list(string), [])
users = optional(list(string), [])
}))
})
default = null
description = "Optional pool administrator permission configuration. kind supports Inherit or SpecificAccounts."
validation {
condition = var.azure_devops_permission == null ? true : contains(
["Inherit", "SpecificAccounts"],
var.azure_devops_permission.kind
)
error_message = "azure_devops_permission.kind must be Inherit or SpecificAccounts."
}
}
##-----------------------------------------------------------------------------
## Agent Profile and Scaling
##-----------------------------------------------------------------------------
variable "maximum_concurrency" {
type = number
default = 1
description = "Maximum number of agents that can be created concurrently."
validation {
condition = var.maximum_concurrency >= 1 && var.maximum_concurrency <= 10000
error_message = "maximum_concurrency must be between 1 and 10000."
}
}
variable "agent_mode" {
type = string
default = "Stateless"
description = "Agent lifecycle mode. Stateless tears down the agent after every Azure DevOps job."
validation {
condition = contains(["Stateless", "Stateful"], var.agent_mode)
error_message = "agent_mode must be Stateless or Stateful."
}
}
variable "automatic_resource_prediction" {
type = object({
prediction_preference = optional(string, "Balanced")
})
default = null
description = "Optional automatic standby-agent prediction configuration. Leave null for no automatic prediction."
validation {
condition = var.automatic_resource_prediction == null ? true : contains([
"MostCostEffective",
"MoreCostEffective",
"Balanced",
"MorePerformance",
"BestPerformance"
], var.automatic_resource_prediction.prediction_preference)
error_message = "Invalid automatic prediction preference."
}
}
variable "manual_resource_prediction" {
type = object({
all_week_schedule = optional(number)
time_zone_name = optional(string, "UTC")
monday_schedule = optional(list(object({
count = number
time = string
})), [])
tuesday_schedule = optional(list(object({
count = number
time = string
})), [])
wednesday_schedule = optional(list(object({
count = number
time = string
})), [])
thursday_schedule = optional(list(object({
count = number
time = string
})), [])
friday_schedule = optional(list(object({
count = number
time = string
})), [])
saturday_schedule = optional(list(object({
count = number
time = string
})), [])
sunday_schedule = optional(list(object({
count = number
time = string
})), [])
})
default = null
description = "Optional manual standby-agent schedule. Leave null for cold-start-only scaling."
}
variable "stateful_grace_period_time_span" {
type = string
default = "00:00:00"
description = "How long an idle stateful agent waits for another job before shutdown."
}
variable "stateful_maximum_agent_lifetime" {
type = string
default = "7.00:00:00"
description = "Maximum lifetime of a stateful agent before replacement."
}
variable "work_folder" {
type = string
default = null
description = "Optional custom work folder used by every agent."
}
##-----------------------------------------------------------------------------
## Managed Identity
##-----------------------------------------------------------------------------
variable "identity_ids" {
type = list(string)
default = []
description = "User Assigned Managed Identity IDs assigned to the Managed DevOps Pool."
}
##-----------------------------------------------------------------------------
## Virtual Machine Scale Set Fabric
##-----------------------------------------------------------------------------
variable "sku_name" {
type = string
default = "Standard_D2ads_v5"
description = "Azure VM SKU used by Managed DevOps Pool agents."
}
variable "os_disk_storage_account_type" {
type = string
default = "Standard"
description = "OS disk type. Supported values are Premium, Standard and StandardSSD."
validation {
condition = contains(["Premium", "Standard", "StandardSSD"], var.os_disk_storage_account_type)
error_message = "os_disk_storage_account_type must be Premium, Standard or StandardSSD."
}
}
variable "subnet_id" {
type = string
default = null
description = "Dedicated subnet delegated to Microsoft.DevOpsInfrastructure/pools. The subnet and pool must be in the same Azure region."
}
variable "images" {
type = list(object({
id = optional(string)
well_known_image_name = optional(string)
aliases = optional(list(string), [])
buffer = optional(string, "*")
}))
default = [
{
well_known_image_name = "ubuntu-24.04/latest"
buffer = "*"
}
]
description = "Agent images. Configure exactly one of id or well_known_image_name for each image."
validation {
condition = length(var.images) > 0
error_message = "At least one agent image must be configured."
}
}
variable "security" {
type = object({
interactive_logon_enabled = optional(bool, false)
key_vault_management = optional(object({
key_vault_certificate_ids = list(string)
certificate_store_location = optional(string)
certificate_store_name = optional(string)
key_export_enabled = optional(bool, false)
}))
})
default = null
description = "Optional agent security and Key Vault certificate configuration."
}
variable "storage" {
type = object({
disk_size_in_gb = number
caching = optional(string)
drive_letter = optional(string)
storage_account_type = optional(string, "Standard_LRS")
})
default = null
description = "Optional attached data disk configuration for agents."
}
##-----------------------------------------------------------------------------
## Optional VNet Role Assignments
##-----------------------------------------------------------------------------
variable "create_network_role_assignments" {
type = bool
default = false
description = "Create Reader and Network Contributor role assignments on the VNet for the DevOpsInfrastructure service principal."
}
variable "virtual_network_id" {
type = string
default = null
description = "VNet resource ID used as the scope for optional network role assignments."
}
variable "devops_infrastructure_principal_id" {
type = string
default = null
description = "Object ID of the Microsoft DevOpsInfrastructure enterprise application in the tenant."
}