forked from DeimosCloud/terraform-google-gitlab-ci-runner
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
419 lines (351 loc) · 12.4 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
variable "project" {
type = string
description = "The GCP project to deploy the runner into."
}
variable "region" {
type = string
description = "The GCP region to deploy the runner into."
}
variable "prefix" {
type = string
default = "ci"
description = "The prefix to apply to all GCP resource names (e.g. <prefix>-runner, <prefix>-agent-1)."
}
variable "runners_metadata" {
description = "(Optional) Metadata key/value pairs to make available from within instances created from this template."
default = {}
}
variable "network" {
description = "The target VPC for the docker-machine and runner instances."
type = string
default = "default"
}
variable "subnetwork" {
description = "Subnetwork used for hosting the gitlab-runners."
type = string
default = ""
}
variable "runners_machine_type" {
description = "Instance type used for the GitLab runner."
type = string
default = "e2-standard-2"
}
variable "runners_preemptible" {
description = "If true, runner compute instances will be premptible"
type = bool
default = true
}
variable "runners_disk_size" {
description = "The size of the created gitlab runner instances in GB."
type = number
default = 30
}
variable "runners_disk_type" {
description = "The Disk type of the gitlab runner instances"
type = string
default = "pd-standard"
}
variable "runners_tags" {
description = "Additional Network tags to be attached to the Gitlab Runner."
type = list(string)
default = []
}
variable "docker_machine_download_url" {
description = "Full url pointing to a linux x64 distribution of docker machine."
type = string
default = "https://gitlab-docker-machine-downloads.s3.amazonaws.com/main/docker-machine-Linux-x86_64"
}
variable "docker_machine_machine_type" {
description = "The Machine Type for the docker-machine instances."
type = string
default = "e2-standard-2"
}
variable "docker_machine_preemptible" {
description = "If true, docker-machine instances will be premptible"
type = bool
default = false
}
variable "runner_machine_image" {
description = "A GCP custom image to use for spinning up runners when using docker-machine"
type = string
default = "cos-cloud/global/images/family/cos-97-lts"
}
variable "docker_machine_disk_type" {
description = "The disk Type for docker-machine instances."
type = string
default = "pd-standard"
}
variable "docker_machine_disk_size" {
description = "The disk size for the docker-machine instances."
type = number
default = 20
}
variable "docker_machine_tags" {
description = "Additional Network tags to be attached to the docker-machine instances."
type = list(string)
default = []
}
variable "docker_machine_use_internal_ip" {
description = "If true, docker-machine instances will have only internal IPs."
default = false
type = bool
}
variable "runners_name" {
description = "Name of the runner, will be used in the runner config.toml."
type = string
}
variable "runners_max_replicas" {
description = "The maximum number of runners to spin up.For docker+machine, this is the max number of instances that will run docker-machine. For docker, this is the maximum number of runner instances. "
type = number
default = 1
}
variable "runners_min_replicas" {
description = "The minimum number of runners to spin up. For docker+machine, this is the min number of instances that will run docker-machine. For docker, this is the minimum number of runner instances"
type = number
default = 1
}
variable "runners_executor" {
description = "The executor to use. Currently supports `docker+machine` or `docker`."
type = string
default = "docker+machine"
}
variable "runners_install_docker_credential_gcr" {
description = "Install docker_credential_gcr inside `startup_script_pre_install` script"
type = bool
default = true
}
variable "runners_gitlab_url" {
description = "URL of the GitLab instance to connect to."
type = string
default = "https://gitlab.com"
}
variable "runners_limit" {
description = "Limit for the runners, will be used in the runner config.toml."
type = number
default = 5
}
variable "runners_concurrent" {
description = "Concurrent value for the runners, will be used in the runner config.toml. Limits how many jobs globally can be run concurrently when running docker-machine."
type = number
default = 10
}
variable "runners_max_growth_rate" {
description = "(docker-machine) The maximum number of machines that can be added to the runner in parallel. Default is 0 (no limit)."
type = number
default = 2
}
variable "runners_idle_time" {
description = "(docker-machine) Idle time of the runners, will be used in the runner config.toml."
type = number
default = 600
}
variable "runners_idle_count" {
description = "(docker-machine) Idle count of the runners, will be used in the runner config.toml."
type = number
default = 0
}
variable "runners_max_builds" {
description = "(docker-machine) Max builds for each runner after which it will be removed, will be used in the runner config.toml. By default set to 0, no maxBuilds will be set in the configuration."
type = number
default = 0
}
variable "runners_image" {
description = "Image to run builds, will be used in the runner config.toml"
type = string
default = "docker:20-dind"
}
variable "runners_privileged" {
description = "Runners will run in privileged mode, will be used in the runner config.toml"
type = bool
default = true
}
variable "runners_disable_cache" {
description = "Runners will not use local cache, will be used in the runner config.toml"
type = bool
default = false
}
variable "runners_additional_volumes" {
description = "Additional volumes that will be used in the runner config.toml, e.g Docker socket"
type = list(any)
default = []
}
variable "runners_shm_size" {
description = "shm_size for the runners, will be used in the runner config.toml"
type = number
default = 0
}
variable "runners_docker_runtime" {
description = "docker runtime for runners, will be used in the runner config.toml"
type = string
default = ""
}
variable "runners_helper_image" {
description = "Overrides the default helper image used to clone repos and upload artifacts, will be used in the runner config.toml"
type = string
default = ""
}
variable "runners_pull_policy" {
description = "pull_policy for the runners, will be used in the runner config.toml"
type = string
default = "always"
}
variable "runners_enable_monitoring" {
description = "Installs Stackdriver monitoring Agent on runner Instances to collect metrics."
type = bool
default = true
}
variable "runners_machine_autoscaling" {
description = "(docker-machine) Set autoscaling parameters based on periods, see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersmachine-section"
type = list(object({
periods = list(string)
idle_count = number
idle_time = number
timezone = string
}))
default = []
}
variable "runners_root_size" {
description = "Runner instance root size in GB."
type = number
default = 16
}
variable "runners_environment_vars" {
description = "Environment variables during build execution, e.g. KEY=Value, see runner-public example. Will be used in the runner config.toml"
type = list(string)
default = []
}
variable "runners_pre_build_script" {
description = "Script to execute in the pipeline just before the build, will be used in the runner config.toml"
type = string
default = "\"\""
}
variable "runners_post_build_script" {
description = "Commands to be executed on the Runner just after executing the build, but before executing after_script. "
type = string
default = "\"\""
}
variable "runners_pre_clone_script" {
description = "Commands to be executed on the Runner before cloning the Git repository. this can be used to adjust the Git client configuration first, for example. "
type = string
default = "\"\""
}
variable "runners_request_concurrency" {
description = "Limit number of concurrent requests for new jobs from GitLab (default 1)"
type = number
default = 1
}
variable "runners_output_limit" {
description = "Sets the maximum build log size in kilobytes, by default set to 4096 (4MB)"
type = number
default = 4096
}
variable "startup_script_pre_install" {
description = "Startup script snippet to insert before GitLab runner install"
type = string
default = ""
}
variable "startup_script_post_install" {
description = "Startup script snippet to insert after GitLab runner install"
type = string
default = ""
}
variable "runners_use_internal_ip" {
description = "Restrict runners to the use of a Internal IP address. NOTE: NAT Gateway must be deployed in your network so that Runners can access resources on the internet"
type = bool
default = false
}
variable "cache_location" {
description = "The location where to create the cache bucket in. If not specified, it defaults to the region"
default = null
}
variable "cache_bucket_versioning" {
description = "Boolean used to enable versioning on the cache bucket, false by default."
type = bool
default = false
}
variable "cache_storage_class" {
description = "The cache storage class"
default = "STANDARD"
}
variable "cache_expiration_days" {
description = "Number of days before cache objects expires."
type = number
default = 2
}
variable "cache_shared" {
description = "Enables cache sharing between runners."
type = bool
default = true
}
variable "gitlab_runner_version" {
description = "Version of the GitLab runner. Defaults to latest"
type = string
default = ""
}
variable "runners_allow_ssh_access" {
description = "Enables SSH Access to the runner instances."
type = bool
default = true
}
variable "runners_ssh_allowed_cidr_blocks" {
description = "List of CIDR blocks to allow SSH Access to the gitlab runner instance."
type = list(string)
default = ["0.0.0.0/0"]
}
variable "labels" {
description = "Map of labels that will be added to created resources"
type = map(string)
default = {}
}
variable "docker_machine_options" {
description = "List of additional options for the docker machine config. Each element of this list must be a key=value pair. E.g. '[\"google-zone=a\"]'"
type = list(string)
default = []
}
variable "gitlab_runner_registration_config" {
description = "Configuration used to register the runner. Available at https://docs.gitlab.com/ee/api/runners.html#register-a-new-runner."
default = {
registration_token = ""
tag_list = ""
description = ""
locked_to_project = ""
run_untagged = ""
maximum_timeout = ""
access_level = "not_protected"
}
# validation {
# condition = var.gitlab_runner_registration_config["registration_token"] != ""
# error_message = "gitlab_runner_registration_config[\"registration_token\"] must be set"
# }
}
variable "create_cache_bucket" {
description = "Creates a cache cloud storage bucket if true"
default = true
}
variable "runners_volumes_tmpfs" {
type = list(object({
volume = string
options = string
}))
default = []
}
variable "runners_services_volumes_tmpfs" {
type = list(object({
volume = string
options = string
}))
default = []
}
variable "runners_target_autoscale_cpu_utilization" {
description = "The target CPU utilization that the autoscaler should maintain. If runner CPU utilization gets above this, a new runner is created until runners_max_replicas is reached"
default = 0.9
}
variable "runner_additional_service_account_roles" {
description = "Additional roles to pass to the Runner service account"
default = []
type = list(string)
}
variable "create_docker_machines_firewall" {
description = "Whether to create the docker-machines firewall. This is required for the runner to work. If deploying multiple runners in the same project, you can set this to false for one of the runners"
default = true
}