-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
47 lines (41 loc) · 1.49 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
variable "project_url" {
type = string
description = "Url to Git repository with sandbox definition, as obtained by Clone with SSH or HTTPS."
}
variable "rev" {
type = string
description = "Git revision of the Git repository from project_url to use."
}
variable "sandbox_count" {
type = number
default = 1
description = "The number of sandboxes to be allocated."
}
variable "pool_size" {
type = number
default = null
description = "The maximum number of sandboxes that can be allocated in a pool. Defaults to sandbox_count."
}
variable "stages" {
type = set(string)
default = ["user-ansible", "networking-ansible", "terraform"]
description = "Set of stages whose output from sandbox allocation will be saved to files in output_directory. One file per each combination of stage and sandbox."
validation {
condition = alltrue([for stage in var.stages : contains(["user-ansible", "networking-ansible", "terraform"], stage)])
error_message = "Valid values in set are (user-ansible, networking-ansible, terraform)."
}
}
variable "output_directory" {
type = string
default = "outputs"
description = "The directory where files with outputs will be created."
}
locals {
_pool_size = var.pool_size != null ? var.pool_size : var.sandbox_count
for_sandbox_stage = { for pair in setproduct(range(var.sandbox_count), var.stages) : "${pair[0]}-${pair[1]}" =>
{
index = pair[0]
stage = pair[1]
}
}
}