-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcan.tf
More file actions
32 lines (26 loc) · 726 Bytes
/
can.tf
File metadata and controls
32 lines (26 loc) · 726 Bytes
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
### Test scenario for "can"
variable "word-length" {
default = 7
validation {
# The condition here identifies if the integer if greater than 1
condition = var.word-length > 1
error_message = "The variable is not greater than 5. Word length has to be at a minimum > 1."
}
}
variable "os" {
default = "linux"
validation {
# The condition here identifies if the variable contains the string "linxu" OR "windows".
condition = can(regex("linux|windows", var.os))
error_message = "ERROR: Operating System must be Windows OR Linux."
}
}
resource "random_pet" "pet" {
length = var.word-length
keepers = {
pet-name = timestamp()
}
}
output "pet" {
value = "${random_pet.pet.id}"
}