-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
259 lines (236 loc) · 9.12 KB
/
variables.tf
File metadata and controls
259 lines (236 loc) · 9.12 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
# General variables
variable "location" {
description = "Specifies the location for all Azure resources."
type = string
sensitive = false
}
variable "environment" {
description = "Specifies the environment of the deployment."
type = string
sensitive = false
default = "dev"
validation {
condition = contains(["int", "dev", "tst", "qa", "uat", "prd"], var.environment)
error_message = "Please use an allowed value: \"int\", \"dev\", \"tst\", \"qa\", \"uat\" or \"prd\"."
}
}
variable "prefix" {
description = "Specifies the prefix for all resources created in this deployment."
type = string
sensitive = false
validation {
condition = length(var.prefix) >= 2 && length(var.prefix) <= 10
error_message = "Please specify a prefix with more than two and less than 10 characters."
}
}
variable "tags" {
description = "Specifies the tags that you want to apply to all resources."
type = map(string)
sensitive = false
default = {}
}
# Function variables
variable "function_container_registry_url" {
description = "Specifies the container image reference of the Azure Function."
type = string
sensitive = false
validation {
condition = startswith(var.function_container_registry_url, "https://")
error_message = "Please specify a valid container image reference."
}
}
variable "function_container_image" {
description = "Specifies the container image reference of the Azure Function."
type = string
sensitive = false
validation {
condition = alltrue([
length(var.function_container_image) > 2,
length(split("/", var.function_container_image)) >= 2,
length(split(":", var.function_container_image)) == 2,
])
error_message = "Please specify a valid container image reference."
}
}
variable "function_sku" {
description = "Specifies the sku name used in the function app service plan."
type = string
sensitive = false
nullable = false
default = "P0v3"
validation {
condition = contains(["F1", "B1", "B2", "B3", "S1", "S2", "S3", "P0v3", "P1v3", "P2v3", "P3v3", "P1mv3", "P2mv3", "P3mv3", "P4mv3", "P5mv3", "EP1", "EP2", "EP3"], var.function_sku)
error_message = "Please specify a valid sku name."
}
}
variable "function_sku_cpus" {
description = "Specifies the number of CPUs available for the function sku used in the app service plan."
type = number
sensitive = false
nullable = false
default = 1
validation {
condition = var.function_sku_cpus > 0
error_message = "Please specify a valid number of cpus."
}
}
variable "function_health_path" {
description = "Specifies the health endpoint of the Azure Function."
type = string
sensitive = false
validation {
condition = startswith(var.function_health_path, "/")
error_message = "Please specify a valid path."
}
}
variable "my_secret" {
description = "Specifies a random secret value used in teh Logic App."
type = string
sensitive = true
validation {
condition = length(var.my_secret) >= 2
error_message = "Please specify a valid resource ID."
}
}
# Logging & Monitoring variables
variable "log_analytics_workspace_id" {
description = "Specifies the resource ID of the log analytics workspace used for collecting logs."
type = string
sensitive = false
validation {
condition = length(split("/", var.log_analytics_workspace_id)) == 9
error_message = "Please specify a valid resource ID."
}
}
variable "alert_endpoints" {
description = "Specifies the alert details."
type = object({
email = optional(object({
email_address = string
}), null)
})
sensitive = false
default = {}
validation {
condition = var.alert_endpoints == {} || length(var.alert_endpoints) > 0
error_message = "Please specify valid alert endpoints."
}
}
# Network variables
variable "connectivity_delay_in_seconds" {
description = "Specifies the delay in seconds after the private endpoint deployment (required for the DNS automation via Policies)."
type = number
sensitive = false
nullable = false
default = 120
validation {
condition = var.connectivity_delay_in_seconds >= 0
error_message = "Please specify a valid non-negative number."
}
}
variable "vnet_id" {
description = "Specifies the resource ID of the Vnet used for the Azure Function."
type = string
sensitive = false
validation {
condition = length(split("/", var.vnet_id)) == 9
error_message = "Please specify a valid resource ID."
}
}
variable "nsg_id" {
description = "Specifies the resource ID of the default network security group for the Azure Function."
type = string
sensitive = false
validation {
condition = length(split("/", var.nsg_id)) == 9
error_message = "Please specify a valid resource ID."
}
}
variable "route_table_id" {
description = "Specifies the resource ID of the default route table for the Azure Function."
type = string
sensitive = false
validation {
condition = length(split("/", var.route_table_id)) == 9
error_message = "Please specify a valid resource ID."
}
}
variable "subnet_cidr_function" {
description = "Specifies the subnet cidr range for the function app subnet."
type = string
sensitive = false
validation {
condition = length(split("/", var.subnet_cidr_function)) == 2
error_message = "Please specify a valid subnet cidr range."
}
}
variable "subnet_cidr_private_endpoints" {
description = "Specifies the subnet cidr range for private endpoints."
type = string
sensitive = false
validation {
condition = length(split("/", var.subnet_cidr_private_endpoints)) == 2
error_message = "Please specify a valid subnet cidr range."
}
}
# DNS variables
variable "private_dns_zone_id_blob" {
description = "Specifies the resource ID of the private DNS zone for Azure Storage blob endpoints. Not required if DNS A-records get created via Azue Policy."
type = string
sensitive = false
default = ""
validation {
condition = var.private_dns_zone_id_blob == "" || (length(split("/", var.private_dns_zone_id_blob)) == 9 && endswith(var.private_dns_zone_id_blob, "privatelink.blob.core.windows.net"))
error_message = "Please specify a valid resource ID for the private DNS Zone."
}
}
variable "private_dns_zone_id_queue" {
description = "Specifies the resource ID of the private DNS zone for Azure Storage queue endpoints. Not required if DNS A-records get created via Azue Policy."
type = string
sensitive = false
default = ""
validation {
condition = var.private_dns_zone_id_queue == "" || (length(split("/", var.private_dns_zone_id_queue)) == 9 && endswith(var.private_dns_zone_id_queue, "privatelink.queue.core.windows.net"))
error_message = "Please specify a valid resource ID for the private DNS Zone."
}
}
variable "private_dns_zone_id_table" {
description = "Specifies the resource ID of the private DNS zone for Azure Storage table endpoints. Not required if DNS A-records get created via Azue Policy."
type = string
sensitive = false
default = ""
validation {
condition = var.private_dns_zone_id_table == "" || (length(split("/", var.private_dns_zone_id_table)) == 9 && endswith(var.private_dns_zone_id_table, "privatelink.table.core.windows.net"))
error_message = "Please specify a valid resource ID for the private DNS Zone."
}
}
variable "private_dns_zone_id_file" {
description = "Specifies the resource ID of the private DNS zone for Azure Storage file endpoints. Not required if DNS A-records get created via Azue Policy."
type = string
sensitive = false
default = ""
validation {
condition = var.private_dns_zone_id_file == "" || (length(split("/", var.private_dns_zone_id_file)) == 9 && endswith(var.private_dns_zone_id_file, "privatelink.file.core.windows.net"))
error_message = "Please specify a valid resource ID for the private DNS Zone."
}
}
variable "private_dns_zone_id_key_vault" {
description = "Specifies the resource ID of the private DNS zone for Azure Key Vault. Not required if DNS A-records get created via Azue Policy."
type = string
sensitive = false
default = ""
validation {
condition = var.private_dns_zone_id_key_vault == "" || (length(split("/", var.private_dns_zone_id_key_vault)) == 9 && endswith(var.private_dns_zone_id_key_vault, "privatelink.vaultcore.azure.net"))
error_message = "Please specify a valid resource ID for the private DNS Zone."
}
}
variable "private_dns_zone_id_sites" {
description = "Specifies the resource ID of the private DNS zone for Azure Websites. Not required if DNS A-records get created via Azue Policy."
type = string
sensitive = false
default = ""
validation {
condition = var.private_dns_zone_id_sites == "" || (length(split("/", var.private_dns_zone_id_sites)) == 9 && endswith(var.private_dns_zone_id_sites, "privatelink.azurewebsites.net"))
error_message = "Please specify a valid resource ID for the private DNS Zone."
}
}