-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
407 lines (351 loc) · 11 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
#####################################################
# IBM Cloud Satellite - GCP
# Copyright 2022 IBM
#####################################################
##########################################################
# GCP and IBM Authentication Variables
##########################################################
variable "TF_VERSION" {
description = "Terraform version"
type = string
default = "0.13"
}
variable "ibm_resource_group" {
description = "Resource group name of the IBM Cloud account."
type = string
}
variable "gcp_project" {
description = "GCP Project ID"
type = string
}
variable "gcp_region" {
description = "Google Region"
type = string
default = "us-east1"
}
###################################################
# IBMCLOUD Satellite Location Variables
###################################################
variable "location" {
description = "Location Name"
default = "satellite-gcp"
validation {
condition = var.location != "" && length(var.location) <= 32
error_message = "Sorry, please provide value for location_name variable or check the length of name it should be less than 32 chars."
}
}
variable "is_location_exist" {
description = "Determines if the location has to be created or not"
type = bool
default = false
}
variable "managed_from" {
description = "The IBM Cloud region to manage your Satellite location from. Choose a region close to your on-prem data center for better performance."
type = string
default = "wdc"
}
variable "location_zones" {
description = "Allocate your hosts across these three zones"
type = list(string)
default = ["us-east1-b", "us-east1-c", "us-east1-d"]
}
variable "location_bucket" {
description = "COS bucket name"
default = ""
}
variable "host_labels" {
description = "Labels to add to attach host script"
type = list(string)
default = ["env:prod"]
validation {
condition = can([for s in var.host_labels : regex("^[a-zA-Z0-9:]+$", s)])
error_message = "Label must be of the form `key:value`."
}
}
####################################################
# Google Resources Variables
####################################################
variable "gcp_resource_prefix" {
description = "Name to be used on all gcp resource as prefix"
type = string
default = "satellite-google"
validation {
condition = var.gcp_resource_prefix != "" && length(var.gcp_resource_prefix) <= 25
error_message = "Sorry, please provide value for resource_prefix variable or check the length of resource_prefix it should be less than 25 chars."
}
}
variable "gcp_security_custom_rules" {
description = "GCP security group custom rules"
type = list(object({
name = string
description = string
direction = string
priority = number
ranges = list(string)
source_tags = list(string)
source_service_accounts = list(string)
target_tags = list(string)
target_service_accounts = list(string)
allow = list(object({
protocol = string
ports = list(string)
}))
deny = list(object({
protocol = string
ports = list(string)
}))
log_config = object({
metadata = string
})
}))
default = [
{
name = "satellite-google-ingress"
description = "Ingress for satellite-google-vpc"
direction = "INGRESS"
priority = 1000
ranges = ["0.0.0.0/0"]
source_tags = null
source_service_accounts = null
target_tags = []
target_service_accounts = null
allow = [
{
protocol = "tcp"
ports = ["30000-32767"]
},
{
protocol = "udp"
ports = ["30000-32767"]
}
]
deny = []
log_config = null
},
{
name = "satellite-google-egress"
description = "Egress rules for satellite-google-vpc"
direction = "EGRESS"
priority = 1000
ranges = ["0.0.0.0/0"]
source_tags = null
source_service_accounts = null
target_tags = []
target_service_accounts = null
allow = [
{
protocol = "all"
ports = []
}
]
deny = []
log_config = null
},
{
name = "satellite-google-private-ingress"
description = "Private Ingress rules for satellite-google-vpc"
direction = "INGRESS"
priority = 1000
ranges = ["10.0.0.0/16"]
source_tags = null
source_service_accounts = null
target_tags = []
target_service_accounts = null
allow = [
{
protocol = "all"
ports = []
}
]
deny = []
log_config = null
},
]
}
variable "satellite_host_count" {
description = "The total number of GCP host to create for control plane. satellite_host_count value should always be in multiples of 3, such as 3, 6, 9, or 12 hosts"
type = number
default = 3
validation {
condition = (var.satellite_host_count % 3) == 0 && var.satellite_host_count > 0
error_message = "Sorry, host_count value should always be in multiples of 3, such as 6, 9, or 12 hosts."
}
}
variable "addl_host_count" {
description = "The total number of additional gcp host"
type = number
default = 3
}
variable "control_plane_instance_type" {
description = "The type of gcp instance to start for control plane."
type = string
default = "n2-standard-4"
}
variable "cluster_instance_type" {
description = "The type of gcp instance to start for cluster."
type = string
default = "n2-standard-4"
}
variable "control_plane_vm_source_image_project" {
description = "Project where the source image comes from for control plane host"
type = string
default = "rhel-cloud"
}
variable "control_plane_vm_source_image_family" {
description = "Source disk image for control plane host"
type = string
default = "rhel-7"
}
variable "control_plane_vm_disk_size_gb" {
description = "Boot disk size in GB for control plane host"
type = number
default = 100
}
variable "control_plane_vm_disk_type" {
description = "Boot disk type, can be either pd-ssd, local-ssd, or pd-standard for control plane host"
type = string
default = "pd-ssd"
}
variable "cluster_vm_source_image_project" {
description = "Project where the source image comes from for cluster host"
type = string
default = "rhel-cloud"
}
variable "cluster_vm_source_image_family" {
description = "Source disk image for cluster host"
type = string
default = "rhel-7"
}
variable "cluster_vm_disk_size_gb" {
description = "Boot disk size in GB for cluster host"
type = number
default = 100
}
variable "cluster_vm_disk_type" {
description = "Boot disk type, can be either pd-ssd, local-ssd, or pd-standard for cluster host"
type = string
default = "pd-ssd"
}
variable "control_plane_vm_access_config" {
description = "Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet."
type = list(object({
nat_ip = string
network_tier = string
}))
default = [{
nat_ip = null
network_tier = "PREMIUM"
}]
}
variable "cluster_vm_access_config" {
description = "Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet."
type = list(object({
nat_ip = string
network_tier = string
}))
default = [{
nat_ip = null
network_tier = "PREMIUM"
}]
}
variable "ssh_public_key" {
description = "SSH Public Key. Get your ssh key by running `ssh-key-gen` command"
type = string
default = null
}
variable "gcp_ssh_user" {
description = "SSH User of above provided ssh_public_key"
type = string
default = null
}
##################################################
# IBMCLOUD ROKS Cluster Variables
##################################################
variable "create_cluster" {
description = "Create Cluster"
type = bool
default = true
}
variable "cluster" {
description = "Cluster name"
type = string
default = "satellite-ibm-cluster"
validation {
error_message = "Cluster name must begin and end with a letter and contain only letters, numbers, and - characters."
condition = can(regex("^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$", var.cluster))
}
}
variable "kube_version" {
description = "Satellite Kube Version"
default = "4.7_openshift"
}
variable "cluster_host_labels" {
description = "Labels to add to attach host script"
type = list(string)
default = ["env:prod"]
validation {
condition = can([for s in var.cluster_host_labels : regex("^[a-zA-Z0-9:]+$", s)])
error_message = "Label must be of the form `key:value`."
}
}
variable "worker_count" {
description = "Worker Count for default pool"
type = number
default = 1
}
variable "wait_for_worker_update" {
description = "Wait for worker update"
type = bool
default = true
}
variable "default_worker_pool_labels" {
description = "Label to add default worker pool"
type = map(any)
default = null
}
variable "tags" {
description = "List of tags associated with cluster."
type = list(string)
default = null
}
variable "create_timeout" {
type = string
description = "Timeout duration for create."
default = null
}
variable "update_timeout" {
type = string
description = "Timeout duration for update."
default = null
}
variable "delete_timeout" {
type = string
description = "Timeout duration for delete."
default = null
}
##################################################
# IBMCLOUD ROKS Cluster Worker Pool Variables
##################################################
variable "create_cluster_worker_pool" {
description = "Create Cluster worker pool"
type = bool
default = true
}
variable "worker_pool_name" {
description = "Satellite Location Name"
type = string
default = "satellite-worker-pool"
validation {
error_message = "Cluster name must begin and end with a letter and contain only letters, numbers, and - characters."
condition = can(regex("^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$", var.worker_pool_name))
}
}
variable "worker_pool_host_labels" {
description = "Labels to add to attach host script"
type = list(string)
default = ["env:prod"]
validation {
condition = can([for s in var.worker_pool_host_labels : regex("^[a-zA-Z0-9:]+$", s)])
error_message = "Label must be of the form `key:value`."
}
}