-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
64 lines (56 loc) · 2.56 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 "gitlab_runner_claim" {
description = "Configuration for GitLab runner claim"
type = object({
gitlab = object({
token = optional(string)
tags = optional(list(string))
runnerType = optional(string)
groupId = optional(number)
projectId = optional(number)
protected = optional(bool, false)
runUntaggedJobs = optional(bool, false)
})
pipelines = optional(object({
ultimateJobTimeout = optional(number)
delayOnStartForJobsWithServices = optional(number)
enableInteractiveWebTerminal = optional(bool)
resources = optional(object({
dropContainerResourceLimits = bool
}))
sharedMountPoints = optional(list(string))
sharedPersistentMountPoints = optional(list(string))
}))
})
validation {
condition = can(regex("^(project_type|group_type|instance_type)$", var.gitlab_runner_claim.gitlab.runnerType))
error_message = "The gitlab.runnerType must be one of 'project_type', 'group_type', or 'instance_type'."
}
validation {
condition = var.gitlab_runner_claim.gitlab.groupId == null || var.gitlab_runner_claim.gitlab.runnerType == "group_type"
error_message = "The gitlab.groupId can only be set if the gitlab.runnerType is 'group_type'."
}
validation {
condition = var.gitlab_runner_claim.gitlab.projectId == null || var.gitlab_runner_claim.gitlab.runnerType == "project_type"
error_message = "The gitlab.projectId can only be set if the gitlab.runnerType is 'project_type'."
}
validation {
condition = var.gitlab_runner_claim.gitlab.runUntaggedJobs || length(var.gitlab_runner_claim.gitlab.tags) > 0
error_message = "Tags must not be empty if runUntaggedJobs is false."
}
validation {
condition = !(var.gitlab_runner_claim.gitlab.groupId != null && var.gitlab_runner_claim.gitlab.projectId != null)
error_message = "groupId and projectId cannot be set simultaneously."
}
validation {
condition = (var.gitlab_runner_claim.gitlab.token == "" || var.gitlab_runner_claim.gitlab.token == null) || (var.gitlab_runner_claim.gitlab.groupId == null && var.gitlab_runner_claim.gitlab.projectId == null)
error_message = "If token is set, neither groupId nor projectId should be set."
}
}
variable "name" {
description = "The name for the GitLabRunnerClaim resource."
type = string
}
variable "namespace" {
description = "Reference to the namespace for GitLabRunnerClaim resources"
type = string
}