-
Notifications
You must be signed in to change notification settings - Fork 26
/
variables.tf
370 lines (336 loc) · 13.2 KB
/
variables.tf
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
variable "container_app_environment_name" {
type = string
description = "(Required) The name of the container apps managed environment. Changing this forces a new resource to be created."
nullable = false
}
variable "container_apps" {
type = map(object({
name = string
tags = optional(map(string))
revision_mode = string
workload_profile_name = optional(string)
template = object({
init_containers = optional(set(object({
args = optional(list(string))
command = optional(list(string))
cpu = optional(number)
image = string
name = string
memory = optional(string)
env = optional(list(object({
name = string
secret_name = optional(string)
value = optional(string)
})))
volume_mounts = optional(list(object({
name = string
path = string
})))
})), [])
containers = set(object({
name = string
image = string
args = optional(list(string))
command = optional(list(string))
cpu = string
memory = string
env = optional(set(object({
name = string
secret_name = optional(string)
value = optional(string)
})))
liveness_probe = optional(object({
failure_count_threshold = optional(number)
header = optional(object({
name = string
value = string
}))
host = optional(string)
initial_delay = optional(number, 1)
interval_seconds = optional(number, 10)
path = optional(string)
port = number
timeout = optional(number, 1)
transport = string
}))
readiness_probe = optional(object({
failure_count_threshold = optional(number)
header = optional(object({
name = string
value = string
}))
host = optional(string)
interval_seconds = optional(number, 10)
path = optional(string)
port = number
success_count_threshold = optional(number, 3)
timeout = optional(number)
transport = string
}))
startup_probe = optional(object({
failure_count_threshold = optional(number)
header = optional(object({
name = string
value = string
}))
host = optional(string)
interval_seconds = optional(number, 10)
path = optional(string)
port = number
timeout = optional(number)
transport = string
}))
volume_mounts = optional(list(object({
name = string
path = string
})))
}))
max_replicas = optional(number)
min_replicas = optional(number)
revision_suffix = optional(string)
custom_scale_rule = optional(list(object({
custom_rule_type = string
metadata = map(string)
name = string
authentication = optional(list(object({
secret_name = string
trigger_parameter = string
})))
})))
http_scale_rule = optional(list(object({
concurrent_requests = string
name = string
authentication = optional(list(object({
secret_name = string
trigger_parameter = optional(string)
})))
})))
volume = optional(set(object({
name = string
storage_name = optional(string)
storage_type = optional(string)
})))
})
ingress = optional(object({
allow_insecure_connections = optional(bool, false)
external_enabled = optional(bool, false)
ip_security_restrictions = optional(list(object({
action = string
ip_address_range = string
name = string
description = optional(string)
})), [])
target_port = number
transport = optional(string)
traffic_weight = object({
label = optional(string)
latest_revision = optional(string)
revision_suffix = optional(string)
percentage = number
})
}))
identity = optional(object({
type = string
identity_ids = optional(list(string))
}))
dapr = optional(object({
app_id = string
app_port = number
app_protocol = optional(string)
}))
registry = optional(list(object({
server = string
username = optional(string)
password_secret_name = optional(string)
identity = optional(string)
})))
}))
description = "The container apps to deploy."
nullable = false
validation {
condition = length(var.container_apps) >= 1
error_message = "At least one container should be provided."
}
validation {
condition = alltrue([for n, c in var.container_apps : c.ingress == null ? true : (c.ingress.ip_security_restrictions == null ? true : (length(distinct([for r in c.ingress.ip_security_restrictions : r.action])) <= 1))])
error_message = "The `action` types in an all `ip_security_restriction` blocks must be the same for the `ingress`, mixing `Allow` and `Deny` rules is not currently supported by the service."
}
validation {
condition = alltrue([for n, c in var.container_apps : c.template.custom_scale_rule == null ? true : alltrue([for _, r in c.template.custom_scale_rule : can(regex("^[a-z0-9][a-z0-9-.]*[a-z0-9]$", r.name))])])
error_message = "The `name` in `custom_scale_rule` must consist of lower case alphanumeric characters, '-', or '.', and should start and end with an alphanumeric character."
}
validation {
condition = alltrue([for n, c in var.container_apps : c.template.http_scale_rule == null ? true : alltrue([for _, r in c.template.http_scale_rule : can(regex("^[a-z0-9][a-z0-9-.]*[a-z0-9]$", r.name))])])
error_message = "The `name` in `http_scale_rule` must consist of lower case alphanumeric characters, '-', or '.', and should start and end with an alphanumeric character."
}
}
variable "location" {
type = string
description = "(Required) The location this container app is deployed in. This should be the same as the environment in which it is deployed."
nullable = false
}
variable "resource_group_name" {
type = string
description = "(Required) The name of the resource group in which the resources will be created."
nullable = false
}
variable "container_app_environment" {
type = object({
name = string
resource_group_name = string
})
default = null
description = "Reference to existing container apps environment to use."
validation {
condition = var.container_app_environment == null ? true : var.container_app_environment.name != null && var.container_app_environment.resource_group_name != null
error_message = "`name` and `resource_group_name` cannot be null"
}
}
variable "container_app_environment_infrastructure_subnet_id" {
type = string
default = null
description = "(Optional) The existing subnet to use for the container apps control plane. Changing this forces a new resource to be created."
}
variable "container_app_environment_internal_load_balancer_enabled" {
type = bool
default = null
description = "(Optional) Should the Container Environment operate in Internal Load Balancing Mode? Defaults to `false`. Changing this forces a new resource to be created."
}
variable "container_app_environment_tags" {
type = map(string)
default = {}
description = "A map of the tags to use on the resources that are deployed with this module."
}
variable "container_app_secrets" {
type = map(list(object({
name = string
value = optional(string, null)
identity = optional(string, null)
key_vault_secret_id = optional(string, null)
})))
default = {}
description = "(Optional) The secrets of the container apps. The key of the map should be aligned with the corresponding container app."
nullable = false
sensitive = true
}
variable "dapr_component" {
type = map(object({
name = string
component_type = string
version = string
ignore_errors = optional(bool, false)
init_timeout = optional(string, "5s")
scopes = optional(list(string))
metadata = optional(set(object({
name = string
secret_name = optional(string)
value = string
})))
}))
default = {}
description = "(Optional) The Dapr component to deploy."
nullable = false
}
variable "dapr_component_secrets" {
type = map(list(object({
name = string
value = string
})))
default = {}
description = "(Optional) The secrets of the Dapr components. The key of the map should be aligned with the corresponding Dapr component."
nullable = false
sensitive = true
}
variable "env_storage" {
type = map(object({
name = string
account_name = string
share_name = string
access_mode = string
}))
default = {}
description = "(Optional) Manages a Container App Environment Storage, writing files to this file share to make data accessible by other systems."
nullable = false
}
variable "environment_storage_access_key" {
type = map(string)
default = null
description = "(Optional) The Storage Account Access Key. The key of the map should be aligned with the corresponding environment storage."
sensitive = true
}
variable "log_analytics_workspace" {
type = object({
id = string
})
default = null
description = "(Optional) A Log Analytics Workspace already exists."
}
variable "log_analytics_workspace_allow_resource_only_permissions" {
type = bool
default = true
description = "(Optional) Specifies if the log Analytics Workspace allow users accessing to data associated with resources they have permission to view, without permission to workspace. Defaults to `true`."
}
variable "log_analytics_workspace_cmk_for_query_forced" {
type = bool
default = false
description = "(Optional) Is Customer Managed Storage mandatory for query management? Defaults to `false`."
}
variable "log_analytics_workspace_daily_quota_gb" {
type = number
default = -1
description = "(Optional) The workspace daily quota for ingestion in GB. Defaults to `-1` which means unlimited."
}
variable "log_analytics_workspace_internet_ingestion_enabled" {
type = bool
default = true
description = "(Optional) Should the Log Analytics Workspace support ingestion over the Public Internet? Defaults to `true`."
}
variable "log_analytics_workspace_internet_query_enabled" {
type = bool
default = true
description = "(Optional) Should the Log Analytics Workspace support query over the Public Internet? Defaults to `true`."
}
variable "log_analytics_workspace_local_authentication_disabled" {
type = bool
default = false
description = "(Optional) Specifies if the log analytics workspace should enforce authentication using Azure Active Directory. Defaults to `false`."
}
variable "log_analytics_workspace_name" {
type = string
default = null
description = "(Optional) Specifies the name of the Log Analytics Workspace. Must set this variable if `var.log_analytics_workspace` is `null`. Changing this forces a new resource to be created."
}
variable "log_analytics_workspace_reservation_capacity_in_gb_per_day" {
type = number
default = null
description = "(Optional) The capacity reservation level in GB for this workspace. Must be in increments of 100 between 100 and 5000. `reservation_capacity_in_gb_per_day` can only be used when the `sku` is set to `CapacityReservation`."
}
variable "log_analytics_workspace_retention_in_days" {
type = number
default = null
description = "(Optional) The workspace data retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730."
}
variable "log_analytics_workspace_sku" {
type = string
default = "PerGB2018"
description = "(Optional) Specifies the SKU of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, `CapacityReservation`, and `PerGB2018`(new SKU as of `2018-04-03`). Defaults to `PerGB2018`. "
}
variable "log_analytics_workspace_tags" {
type = map(string)
default = null
description = "(Optional) A mapping of tags to assign to the resource."
}
# tflint-ignore: terraform_unused_declarations
variable "tracing_tags_enabled" {
type = bool
default = false
description = "Whether enable tracing tags that generated by BridgeCrew Yor."
nullable = false
}
# tflint-ignore: terraform_unused_declarations
variable "tracing_tags_prefix" {
type = string
default = "avm_"
description = "Default prefix for generated tracing tags"
nullable = false
}