-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathvariables.tf
More file actions
187 lines (153 loc) · 7.28 KB
/
Copy pathvariables.tf
File metadata and controls
187 lines (153 loc) · 7.28 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
variable "aad_tenant_id" {
type = string
description = "The Microsoft Entra tenant id."
validation {
condition = can(regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", var.aad_tenant_id))
error_message = "Must be a valid GUID in the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'."
}
}
variable "additional_tags" {
type = map(string)
description = "Extra tags merged over the base tags map."
default = {}
}
variable "arm_client_id" {
type = string
description = "The AppId of the service principal used for authenticating with Azure. Must have an 'Owner' role assignment."
validation {
condition = can(regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", var.arm_client_id))
error_message = "Must be a valid GUID in the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'."
}
}
variable "arm_client_secret" {
type = string
description = "The password for the service principal used for authenticating with Azure. Set interactively or using an environment variable 'TF_VAR_arm_client_secret'."
sensitive = true
validation {
condition = length(var.arm_client_secret) >= 8
error_message = "Must be at least 8 characters long."
}
}
variable "enable_module_avd" {
type = bool
description = "Set to true to enable the Azure Virtual Desktop (AVD) module, false to skip it."
default = false
validation {
condition = !var.enable_module_avd || var.enable_module_vnet_app
error_message = "enable_module_vnet_app must be true when enable_module_avd is true because the avd module references resources from the vnet_app module."
}
}
variable "enable_module_mssql" {
type = bool
description = "Set to true to enable the Azure SQL Database (mssql) module, false to skip it."
default = false
validation {
condition = !var.enable_module_mssql || var.enable_module_vnet_app
error_message = "enable_module_vnet_app must be true when enable_module_mssql is true because the mssql module references resources from the vnet_app module."
}
}
variable "enable_module_mysql" {
type = bool
description = "Set to true to enable the Azure Database for MySQL (mysql) module, false to skip it."
default = false
validation {
condition = !var.enable_module_mysql || var.enable_module_vnet_app
error_message = "enable_module_vnet_app must be true when enable_module_mysql is true because the mysql module references resources from the vnet_app module."
}
}
variable "enable_module_petstore" {
type = bool
description = "Set to true to enable the petstore module, false to skip it."
default = false
validation {
condition = !var.enable_module_petstore || var.enable_module_vnet_app
error_message = "enable_module_vnet_app must be true when enable_module_petstore is true because the petstore module references resources from the vnet_app module."
}
}
variable "enable_module_vm_jumpbox_linux" {
type = bool
description = "Set to true to enable the vm_jumpbox_linux module, false to skip it."
default = false
validation {
condition = !var.enable_module_vm_jumpbox_linux || var.enable_module_vnet_app
error_message = "enable_module_vnet_app must be true when enable_module_vm_jumpbox_linux is true because the vm_jumpbox_linux module references resources from the vnet_app module."
}
}
variable "enable_module_vm_mssql_win" {
type = bool
description = "Set to true to enable the vm_mssql_win module, false to skip it."
default = false
validation {
condition = !var.enable_module_vm_mssql_win || var.enable_module_vnet_app
error_message = "enable_module_vnet_app must be true when enable_module_vm_mssql_win is true because the vm_mssql_win module references resources from the vnet_app module."
}
}
variable "enable_module_vnet_app" {
type = bool
description = "Set to true to enable the vnet_app module, false to skip it."
default = false
}
variable "enable_module_vnet_onprem" {
type = bool
description = "Set to true to enable the vnet_onprem module, false to skip it."
default = false
validation {
condition = !var.enable_module_vnet_onprem || (var.enable_module_vnet_app && var.enable_module_vwan)
error_message = "enable_module_vnet_app and enable_module_vwan must both be true when enable_module_vnet_onprem is true because the vnet_onprem module references resources from both."
}
}
variable "enable_module_vwan" {
type = bool
description = "Set to true to enable the vwan module, false to skip it."
default = false
validation {
condition = !var.enable_module_vwan || var.enable_module_vnet_app
error_message = "enable_module_vnet_app must be true when enable_module_vwan is true because the vwan module references resources from the vnet_app module."
}
}
variable "location" {
type = string
description = "The name of the Azure Region where resources will be provisioned."
validation {
condition = can(regex("^[a-z0-9-]+$", var.location))
error_message = "Must be a valid Azure region name. It should only contain lowercase letters, numbers, and dashes."
}
}
variable "subscription_id" {
type = string
description = "The Azure subscription id used to provision resources."
validation {
condition = can(regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", var.subscription_id))
error_message = "Must be a valid GUID in the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'."
}
}
variable "tags" {
type = map(any)
description = "The tags in map format to be used when creating new resources."
default = { costcenter = "mycostcenter", environment = "dev", project = "sand" }
validation {
condition = alltrue([
for key, value in var.tags :
can(regex("^[a-zA-Z0-9._-]{1,512}$", key)) &&
can(regex("^[a-zA-Z0-9._ -]{0,256}$", value))
])
error_message = "Each tag key must be 1-512 characters long and consist of alphanumeric characters, periods (.), underscores (_), or hyphens (-). Each tag value must be 0-256 characters long and consist of alphanumeric characters, periods (.), underscores (_), spaces, or hyphens (-)."
}
}
# tflint-ignore: terraform_unused_declarations # Public input consumed by bootstrap tooling and validated here; not referenced by a resource.
variable "user_name" {
type = string
description = "The user name of the user in Microsoft Entra ID."
validation {
condition = can(regex("^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]@[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9]\\.[a-zA-Z]{2,}$", var.user_name))
error_message = "Must be a valid User Principal Name (UPN) format like 'user@domain.com'. The username part must start and end with alphanumeric characters and can contain periods (.), underscores (_), or hyphens (-). The domain must be a valid domain name."
}
}
variable "user_object_id" {
type = string
description = "The object id of the user in Microsoft Entra ID."
validation {
condition = can(regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", var.user_object_id))
error_message = "Must be a valid GUID in the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'."
}
}