-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvariables.tf
278 lines (239 loc) · 8.25 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
variable "namespace" {
type = string
description = "Namespace (e.g. `cp` or `cloudposse`)"
default = ""
}
variable "stage" {
type = string
description = "Stage (e.g. `prod`, `dev`, `staging`)"
default = ""
}
variable "name" {
type = string
description = "Solution name, e.g. 'app' or 'jenkins'"
}
variable "delimiter" {
type = string
default = "-"
description = "Delimiter to be used between `namespace`, `name`, `stage` and `attributes`"
}
variable "attributes" {
type = list(string)
default = []
description = "Additional attributes, e.g. `1`"
}
variable "tags" {
type = map(string)
default = {}
description = "Additional tags (e.g. `map(`BusinessUnit`,`XYZ`)"
}
variable "availability_zone" {
type = string
description = "Availability Zone (e.g. `a`, `b`, `c` etc.) for instances to be launched in"
default = "a"
}
variable "gitlab_url" {
type = string
default = "https://gitlab.com"
description = "Gitlab URL"
}
variable "registration_token" {
type = string
default = null
description = "Runner registration token"
}
variable "registration_token_ssm_param" {
type = string
default = null
description = "SSM Parameter name that stored runner registration token. This parameter takes precedence over `registration_token`"
}
variable "registration_token_ssm_param_kms_key" {
type = string
default = null
description = "Identifier of KMS key used for encryption of SSM Parameter that stores registration token"
}
variable "authentication_token_ssm_param" {
type = string
default = null
description = "An override for SSM Parameter name that will store runner authentication token"
}
variable "authentication_token_ssm_param_kms_key" {
type = string
default = null
description = "Identifier of KMS key used for encryption of SSM Parameter that will store authentication token"
}
variable "vpc" {
type = object({
vpc_id = string
cidr_block = string
})
description = "VPC configuration"
}
variable "manager" {
description = "Runners' manager (aka bastion) configuration"
type = object({
ami_id = string
ami_owner = string
instance_type = string
key_pair = string
subnet_id = string
associate_public_ip_address = bool
assign_eip_address = bool
root_volume_size = number
ebs_optimized = bool
enable_detailed_monitoring = bool
metadata_http_endpoint_enabled = bool
metadata_http_put_response_hop_limit = number
metadata_http_tokens_required = bool
})
}
variable "runner" {
description = "Gitlab runner configuration. See https://docs.gitlab.com/runner/configuration/advanced-configuration.html"
type = object({
concurrent = number
limit = number
image = string
tags = list(string)
use_private_address = bool
instance_type = string
ami_id = string
run_untagged = bool
lock_to_project = bool
idle = object({
count = number
time = number
})
autoscaling_periods = list(object({
periods = list(string)
idle_count = number
idle_time = number
timezone = string
}))
request_spot_instances = bool
spot_bid_price = number
spot_block_duration = number
})
}
# Links:
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
variable "runner_advanced_config" {
type = object({
pre_build_script = string
post_build_script = string
pre_clone_script = string
environment = list(string)
request_concurrency = number
output_limit = number
shm_size = number
max_builds = number
pull_policy = string
additional_volumes = list(string)
additional_docker_machine_options = list(string)
root_volume_size = number
ebs_optimized = bool
enable_detailed_monitoring = bool
})
default = {
pre_build_script = ""
post_build_script = ""
pre_clone_script = ""
environment = []
request_concurrency = 1
output_limit = 4096
shm_size = 0
max_builds = 0
pull_policy = "always"
additional_volumes = ["/certs/client"]
additional_docker_machine_options = []
root_volume_size = 20
ebs_optimized = false
enable_detailed_monitoring = false
}
description = "Advanced configuration options for gitlab runner"
}
variable "docker_machine_version" {
default = "0.16.2-gitlab.13"
type = string
description = "Docker machine version to be installed on manager instance"
}
variable "gitlab_runner_version" {
default = "14.2.0"
type = string
description = "Gitlab runner version to be installed on manager instance"
}
variable "create_spot_service_linked_role" {
default = true
type = bool
description = "Defines whether to create service-linked role for EC2 spot instances"
}
variable "create_autoscaling_service_linked_role" {
default = true
type = bool
description = "Defines whether to create service-linked role for EC2 autoscaling"
}
variable "enable_cloudwatch_logs" {
default = true
type = bool
description = "Defines whether manager instance should ship its logs to Cloudwatch"
}
variable "cloudwatch_logs_retention" {
default = 30
type = number
description = "Number of days you want to retain log events in Cloudwatch log group"
}
variable "cloudwatch_logs_kms_key_arn" {
type = string
default = null
description = "The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested."
}
variable "enable_s3_cache" {
default = true
type = bool
description = "Defines whether s3 should be created and used as a source for distributed cache"
}
variable "s3_cache_infrequent_access_transition" {
type = number
default = 30
description = "Number of days to persist in the standard storage tier before moving to the infrequent access tier"
}
variable "s3_cache_expiration" {
type = number
default = 45
description = "Number of days you want to retain cache in S3 bucket"
}
variable "enable_ssm_sessions" {
default = true
type = bool
description = "Defines whether access via SSM Session Manager should be enabled for manager instance"
}
variable "enable_access_to_ecr_repositories" {
type = list(string)
default = []
description = "A list of ECR repositories in specified `region` that manager instance should have read-only access to"
}
variable "metrics_port" {
type = number
default = 9252
description = "See https://docs.gitlab.com/runner/monitoring/#configuration-of-the-metrics-http-server for more details"
}
variable "additional_security_groups" {
description = "List of Security Group IDs allowed to be associated with manager instance"
type = list(string)
default = []
}
variable "allowed_metrics_cidr_blocks" {
type = list(object({
cidr_blocks = list(string)
description = string
}))
default = []
description = "CIDR blocks that should be able to access metrics port exposed on manager instance"
}
variable "allowed_ssh_cidr_blocks" {
type = list(object({
cidr_blocks = list(string)
description = string
}))
default = []
description = "CIDR blocks that should be able to communicate with manager's 22 port"
}