generated from masterpointio/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
60 lines (57 loc) · 1.52 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
variable "policies" {
description = "Map of Policies with their configurations."
type = map(object({
body = optional(string, null)
body_url = optional(string, null)
body_file = optional(string, null)
type = string
description = optional(string, null)
labels = optional(list(string), [])
space_id = optional(string, null)
}))
default = {}
validation {
condition = alltrue([
for name, policy in var.policies : (
length(compact([
policy.body,
policy.body_url,
policy.body_file
])) == 1
)
])
error_message = "Each Policy must have exactly one of 'body', 'body_url', or 'body_file' defined."
}
validation {
condition = alltrue([
for name, policy in var.policies :
contains([
"ACCESS",
"APPROVAL",
"GIT_PUSH",
"INITIALIZATION",
"LOGIN",
"PLAN",
"TASK",
"TRIGGER",
"NOTIFICATION"
], policy.type)
])
error_message = <<-EOT
Each policy must have a `type` that is one of the allowed values:
- ACCESS
- APPROVAL
- GIT_PUSH
- INITIALIZATION
- LOGIN
- PLAN
- TASK
- TRIGGER
- NOTIFICATION
Deprecated types are not allowed. If you're using any of the following deprecated types, please update them:
- STACK_ACCESS (use ACCESS instead)
- TASK_RUN (use TASK instead)
- TERRAFORM_PLAN (use PLAN instead)
EOT
}
}