-
Notifications
You must be signed in to change notification settings - Fork 409
/
variables.tf
410 lines (358 loc) · 12.1 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
/**
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
variable "project_id" {
description = "The project ID to manage the Cloud SQL resources"
type = string
}
variable "name" {
type = string
description = "The name of the Cloud SQL resources"
}
variable "random_instance_name" {
type = bool
description = "Sets random suffix at the end of the Cloud SQL resource name"
default = false
}
variable "replica_database_version" {
description = "The read replica database version to use. This var should only be used during a database update. The update sequence 1. read-replica 2. master, setting this to an updated version will cause the replica to update, then you may update the master with the var database_version and remove this field after update is complete"
type = string
default = ""
}
// required
variable "database_version" {
description = "The database version to use"
type = string
}
// required
variable "region" {
description = "The region of the Cloud SQL resources"
type = string
default = "us-central1"
}
// Master
variable "tier" {
description = "The tier for the master instance."
type = string
default = "db-n1-standard-1"
}
variable "zone" {
description = "The zone for the master instance, it should be something like: `us-central1-a`, `us-east1-c`."
type = string
}
variable "secondary_zone" {
type = string
description = "The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`."
default = null
}
variable "follow_gae_application" {
type = string
description = "A Google App Engine application whose zone to remain in. Must be in the same region as this instance."
default = null
}
variable "activation_policy" {
description = "The activation policy for the master instance. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`."
type = string
default = "ALWAYS"
}
variable "availability_type" {
description = "The availability type for the master instance. Can be either `REGIONAL` or `null`."
type = string
default = "REGIONAL"
}
variable "deletion_protection_enabled" {
description = "Enables protection of an instance from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform)."
type = bool
default = false
}
variable "read_replica_deletion_protection_enabled" {
description = "Enables protection of a read replica from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform)."
type = bool
default = false
}
variable "disk_autoresize" {
description = "Configuration to increase storage size"
type = bool
default = true
}
variable "disk_autoresize_limit" {
description = "The maximum size to which storage can be auto increased."
type = number
default = 0
}
variable "disk_size" {
description = "The disk size for the master instance"
type = number
default = 10
}
variable "disk_type" {
description = "The disk type for the master instance."
type = string
default = "PD_SSD"
}
variable "pricing_plan" {
description = "The pricing plan for the master instance."
type = string
default = "PER_USE"
}
variable "maintenance_window_day" {
description = "The day of week (1-7) for the master instance maintenance."
type = number
default = 1
}
variable "maintenance_window_hour" {
description = "The hour of day (0-23) maintenance window for the master instance maintenance."
type = number
default = 23
}
variable "maintenance_window_update_track" {
description = "The update track of maintenance window for the master instance maintenance. Can be either `canary` or `stable`."
type = string
default = "canary"
}
variable "database_flags" {
description = "List of Cloud SQL flags that are applied to the database server. See [more details](https://cloud.google.com/sql/docs/mysql/flags)"
type = list(object({
name = string
value = string
}))
default = []
}
variable "user_labels" {
type = map(string)
default = {}
description = "The key/value labels for the master instances."
}
variable "deny_maintenance_period" {
description = "The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. See [more details](https://cloud.google.com/sql/docs/mysql/maintenance)"
type = list(object({
end_date = string
start_date = string
time = string
}))
default = []
}
variable "backup_configuration" {
description = "The backup_configuration settings subblock for the database setings"
type = object({
binary_log_enabled = bool
enabled = bool
start_time = string
location = string
transaction_log_retention_days = string
retained_backups = number
retention_unit = string
})
default = {
binary_log_enabled = false
enabled = false
start_time = null
location = null
transaction_log_retention_days = null
retained_backups = null
retention_unit = null
}
}
variable "insights_config" {
description = "The insights_config settings for the database."
type = object({
query_string_length = number
record_application_tags = bool
record_client_address = bool
})
default = null
}
variable "ip_configuration" {
description = "The ip_configuration settings subblock"
type = object({
authorized_networks = list(map(string))
ipv4_enabled = bool
private_network = string
require_ssl = bool
allocated_ip_range = string
enable_private_path_for_google_cloud_services = optional(bool)
})
default = {
authorized_networks = []
ipv4_enabled = true
private_network = null
require_ssl = null
allocated_ip_range = null
enable_private_path_for_google_cloud_services = false
}
}
variable "password_validation_policy_config" {
description = "The password validation policy settings for the database instance."
type = object({
enable_password_policy = bool
min_length = number
complexity = string
disallow_username_substring = bool
})
default = null
}
// Read Replicas
variable "read_replicas" {
description = "List of read replicas to create. Encryption key is required for replica in different region. For replica in same region as master set encryption_key_name = null"
type = list(object({
name = string
name_override = optional(string)
tier = string
zone = string
availability_type = string
disk_type = string
disk_autoresize = bool
disk_autoresize_limit = number
disk_size = string
user_labels = map(string)
database_flags = list(object({
name = string
value = string
}))
insights_config = optional(object({
query_string_length = number
record_application_tags = bool
record_client_address = bool
}))
ip_configuration = object({
authorized_networks = list(map(string))
ipv4_enabled = bool
private_network = string
require_ssl = bool
allocated_ip_range = string
})
encryption_key_name = string
}))
default = []
}
variable "read_replica_name_suffix" {
description = "The optional suffix to add to the read instance name"
type = string
default = ""
}
variable "db_name" {
description = "The name of the default database to create"
type = string
default = "default"
}
variable "db_charset" {
description = "The charset for the default database"
type = string
default = ""
}
variable "db_collation" {
description = "The collation for the default database. Example: 'utf8_general_ci'"
type = string
default = ""
}
variable "additional_databases" {
description = "A list of databases to be created in your cluster"
type = list(object({
name = string
charset = string
collation = string
}))
default = []
}
variable "user_name" {
description = "The name of the default user"
type = string
default = "default"
}
variable "user_host" {
description = "The host for the default user"
type = string
default = "%"
}
variable "root_password" {
description = "Mysql password for the root user. If not set, a random one will be generated and available in the root_password output variable."
type = string
default = ""
}
variable "user_password" {
description = "The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable."
type = string
default = ""
}
variable "additional_users" {
description = "A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set."
type = list(object({
name = string
password = string
random_password = bool
type = string
host = string
}))
default = []
validation {
condition = length([for user in var.additional_users : false if user.random_password == true && (user.password != null && user.password != "")]) == 0
error_message = "You cannot set both password and random_password, choose one of them."
}
}
variable "create_timeout" {
description = "The optional timout that is applied to limit long database creates."
type = string
default = "30m"
}
variable "update_timeout" {
description = "The optional timout that is applied to limit long database updates."
type = string
default = "30m"
}
variable "delete_timeout" {
description = "The optional timout that is applied to limit long database deletes."
type = string
default = "30m"
}
variable "encryption_key_name" {
description = "The full path to the encryption key used for the CMEK disk encryption"
type = string
default = null
}
variable "module_depends_on" {
description = "List of modules or resources this module depends on."
type = list(any)
default = []
}
variable "deletion_protection" {
description = "Used to block Terraform from deleting a SQL Instance."
type = bool
default = true
}
variable "read_replica_deletion_protection" {
description = "Used to block Terraform from deleting replica SQL Instances."
type = bool
default = false
}
variable "enable_default_db" {
description = "Enable or disable the creation of the default database"
type = bool
default = true
}
variable "enable_default_user" {
description = "Enable or disable the creation of the default user"
type = bool
default = true
}
variable "enable_random_password_special" {
description = "Enable special characters in generated random passwords."
type = bool
default = false
}
variable "connector_enforcement" {
description = "Enforce that clients use the connector library"
type = bool
default = false
}