generated from plus3it/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvariables.tf
64 lines (60 loc) · 1.87 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
variable "account_alternate_contacts" {
type = object({
billing = optional(object({
name = string
title = string
email_address = string
phone_number = string
}))
operations = optional(object({
name = string
title = string
email_address = string
phone_number = string
}))
security = optional(object({
name = string
title = string
email_address = string
phone_number = string
}))
})
validation {
condition = alltrue([
for contact in var.account_alternate_contacts :
length(contact.name) >= 1 &&
length(contact.name) <= 64
if contact != null
])
error_message = "Invalid value for Name (must be between 1 and 64 characters)"
}
validation {
condition = alltrue([
for contact in var.account_alternate_contacts :
length(contact.title) >= 1 &&
length(contact.title) <= 50
if contact != null
])
error_message = "Invalid value for Title (must be between 1 and 50 characters)"
}
validation {
condition = alltrue([
for contact in var.account_alternate_contacts :
length(contact.email_address) >= 1 &&
length(contact.email_address) <= 254 &&
can(regex("^[\\s]*[\\w+=.#|!&-]+@[\\w.-]+\\.[\\w]+[\\s]*$", contact.email_address))
if contact != null
])
error_message = "Invalid value for email address (must be between 1 and 254 characters and correct syntax)"
}
validation {
condition = alltrue([
for contact in var.account_alternate_contacts :
length(contact.phone_number) >= 1 &&
length(contact.phone_number) <= 25 &&
can(regex("^[\\s0-9()+-]+$", contact.phone_number))
if contact != null
])
error_message = "Invalid value for phone number (must be between 1 and 25 characters and correct syntax)"
}
}