forked from cloudposse/terraform-aws-rds-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
516 lines (437 loc) · 15.9 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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
variable "zone_id" {
type = any
default = []
description = <<-EOT
Route53 DNS Zone ID as list of string (0 or 1 items). If empty, no custom DNS name will be published.
If the list contains a single Zone ID, a custom DNS name will be pulished in that zone.
Can also be a plain string, but that use is DEPRECATED because of Terraform issues.
EOT
}
variable "security_groups" {
type = list(string)
default = []
description = "List of security groups to be allowed to connect to the DB instance"
}
variable "vpc_id" {
type = string
description = "VPC ID to create the cluster in (e.g. `vpc-a22222ee`)"
}
variable "subnets" {
type = list(string)
description = "List of VPC subnet IDs"
}
variable "instance_type" {
type = string
default = "db.t2.small"
description = "Instance type to use"
}
variable "cluster_identifier" {
type = string
default = ""
description = "The RDS Cluster Identifier. Will use generated label ID if not supplied"
}
variable "cluster_size" {
type = number
default = 2
description = "Number of DB instances to create in the cluster"
}
variable "snapshot_identifier" {
type = string
default = null
description = "Specifies whether or not to create this cluster from a snapshot"
}
variable "db_name" {
type = string
default = ""
description = "Database name (default is not to create a database)"
}
variable "db_port" {
type = number
default = 3306
description = "Database port"
}
variable "admin_user" {
type = string
default = "admin"
description = "Username for the master DB user. Ignored if snapshot_identifier or replication_source_identifier is provided"
}
variable "admin_password" {
type = string
default = ""
description = "Password for the master DB user. Ignored if snapshot_identifier or replication_source_identifier is provided"
}
variable "retention_period" {
type = number
default = 5
description = "Number of days to retain backups for"
}
variable "backup_window" {
type = string
default = "07:00-09:00"
description = "Daily time range during which the backups happen"
}
variable "maintenance_window" {
type = string
default = "wed:03:00-wed:04:00"
description = "Weekly time range during which system maintenance can occur, in UTC"
}
variable "cluster_parameters" {
type = list(object({
apply_method = string
name = string
value = string
}))
default = []
description = "List of DB cluster parameters to apply"
}
variable "instance_parameters" {
type = list(object({
apply_method = string
name = string
value = string
}))
default = []
description = "List of DB instance parameters to apply"
}
variable "db_cluster_instance_class" {
type = string
default = null
description = "This setting is required to create a provisioned Multi-AZ DB cluster"
}
variable "cluster_family" {
type = string
default = "aurora5.6"
description = "The family of the DB cluster parameter group"
}
variable "engine" {
type = string
default = "aurora"
description = "The name of the database engine to be used for this DB cluster. Valid values: `aurora`, `aurora-mysql`, `aurora-postgresql`"
}
variable "engine_mode" {
type = string
default = "provisioned"
description = "The database engine mode. Valid values: `parallelquery`, `provisioned`, `serverless`"
}
variable "engine_version" {
type = string
default = ""
description = "The version of the database engine to use. See `aws rds describe-db-engine-versions` "
}
variable "allow_major_version_upgrade" {
type = bool
default = false
description = "Enable to allow major engine version upgrades when changing engine versions. Defaults to false."
}
variable "auto_minor_version_upgrade" {
type = bool
default = true
description = "Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window"
}
variable "s3_import" {
type = object({
bucket_name = string
bucket_prefix = string
ingestion_role = string
source_engine = string
source_engine_version = string
})
default = null
description = "Restore from a Percona Xtrabackup in S3. The `bucket_name` is required to be in the same region as the resource."
}
variable "scaling_configuration" {
type = list(object({
auto_pause = bool
max_capacity = number
min_capacity = number
seconds_until_auto_pause = number
timeout_action = string
}))
default = []
description = "List of nested attributes with scaling properties. Only valid when `engine_mode` is set to `serverless`"
}
variable "serverlessv2_scaling_configuration" {
type = object({
min_capacity = number
max_capacity = number
})
default = null
description = "serverlessv2 scaling properties"
}
variable "timeouts_configuration" {
type = list(object({
create = string
update = string
delete = string
}))
default = []
description = "List of timeout values per action. Only valid actions are `create`, `update` and `delete`"
}
variable "restore_to_point_in_time" {
type = list(object({
source_cluster_identifier = string
restore_type = optional(string, "copy-on-write")
use_latest_restorable_time = optional(bool, true)
restore_to_time = optional(string, null)
}))
default = []
description = <<-EOT
List of point-in-time recovery options. Valid parameters are:
`source_cluster_identifier`
Identifier of the source database cluster from which to restore.
`restore_type`:
Type of restore to be performed. Valid options are "full-copy" and "copy-on-write".
`use_latest_restorable_time`:
Set to true to restore the database cluster to the latest restorable backup time. Conflicts with `restore_to_time`.
`restore_to_time`:
Date and time in UTC format to restore the database cluster to. Conflicts with `use_latest_restorable_time`.
EOT
}
variable "allowed_cidr_blocks" {
type = list(string)
default = []
description = "List of CIDR blocks allowed to access the cluster"
}
variable "publicly_accessible" {
type = bool
description = "Set to true if you want your cluster to be publicly accessible (such as via QuickSight)"
default = false
}
variable "storage_encrypted" {
type = bool
description = "Specifies whether the DB cluster is encrypted. The default is `false` for `provisioned` `engine_mode` and `true` for `serverless` `engine_mode`"
default = false
}
variable "storage_type" {
type = string
description = "One of 'standard' (magnetic), 'gp2' (general purpose SSD), 'io1' (provisioned IOPS SSD), 'aurora', or 'aurora-iopt1'"
default = null
}
variable "iops" {
type = number
description = "The amount of provisioned IOPS. Setting this implies a storage_type of 'io1'. This setting is required to create a Multi-AZ DB cluster. Check TF docs for values based on db engine"
default = null
}
variable "allocated_storage" {
type = number
description = "The allocated storage in GBs"
default = null
}
variable "kms_key_arn" {
type = string
description = "The ARN for the KMS encryption key. When specifying `kms_key_arn`, `storage_encrypted` needs to be set to `true`"
default = ""
}
variable "skip_final_snapshot" {
type = bool
description = "Determines whether a final DB snapshot is created before the DB cluster is deleted"
default = true
}
variable "copy_tags_to_snapshot" {
type = bool
description = "Copy tags to backup snapshots"
default = false
}
variable "deletion_protection" {
type = bool
description = "If the DB instance should have deletion protection enabled"
default = false
}
variable "apply_immediately" {
type = bool
description = "Specifies whether any cluster modifications are applied immediately, or during the next maintenance window"
default = true
}
variable "iam_database_authentication_enabled" {
type = bool
description = "Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled"
default = false
}
variable "rds_monitoring_interval" {
type = number
description = "The interval, in seconds, between points when enhanced monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60"
default = 0
}
variable "rds_monitoring_role_arn" {
type = string
description = "The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs"
default = null
}
variable "enhanced_monitoring_role_enabled" {
type = bool
description = "A boolean flag to enable/disable the creation of the enhanced monitoring IAM role. If set to `false`, the module will not create a new role and will use `rds_monitoring_role_arn` for enhanced monitoring"
default = false
}
variable "replication_source_identifier" {
type = string
description = "ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica"
default = ""
}
variable "enabled_cloudwatch_logs_exports" {
type = list(string)
description = "List of log types to export to cloudwatch. The following log types are supported: audit, error, general, slowquery"
default = []
}
variable "performance_insights_enabled" {
type = bool
default = false
description = "Whether to enable Performance Insights"
}
variable "performance_insights_kms_key_id" {
type = string
default = ""
description = "The ARN for the KMS key to encrypt Performance Insights data. When specifying `performance_insights_kms_key_id`, `performance_insights_enabled` needs to be set to true"
}
variable "performance_insights_retention_period" {
description = "Amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years)"
type = number
default = null
}
variable "autoscaling_enabled" {
type = bool
default = false
description = "Whether to enable cluster autoscaling"
}
variable "autoscaling_policy_type" {
type = string
default = "TargetTrackingScaling"
description = "Autoscaling policy type. `TargetTrackingScaling` and `StepScaling` are supported"
}
variable "autoscaling_target_metrics" {
type = string
default = "RDSReaderAverageCPUUtilization"
description = "The metrics type to use. If this value isn't provided the default is CPU utilization"
}
variable "autoscaling_target_value" {
type = number
default = 75
description = "The target value to scale with respect to target metrics"
}
variable "autoscaling_scale_in_cooldown" {
type = number
default = 300
description = "The amount of time, in seconds, after a scaling activity completes and before the next scaling down activity can start. Default is 300s"
}
variable "autoscaling_scale_out_cooldown" {
type = number
default = 300
description = "The amount of time, in seconds, after a scaling activity completes and before the next scaling up activity can start. Default is 300s"
}
variable "autoscaling_min_capacity" {
type = number
default = 1
description = "Minimum number of instances to be maintained by the autoscaler"
}
variable "autoscaling_max_capacity" {
type = number
default = 5
description = "Maximum number of instances to be maintained by the autoscaler"
}
variable "instance_availability_zone" {
type = string
default = ""
description = "Optional parameter to place cluster instances in a specific availability zone. If left empty, will place randomly"
}
variable "cluster_dns_name" {
type = string
description = "Name of the cluster CNAME record to create in the parent DNS zone specified by `zone_id`. If left empty, the name will be auto-asigned using the format `master.var.name`"
default = ""
}
variable "reader_dns_name" {
type = string
description = "Name of the reader endpoint CNAME record to create in the parent DNS zone specified by `zone_id`. If left empty, the name will be auto-asigned using the format `replicas.var.name`"
default = ""
}
variable "cluster_type" {
type = string
description = <<-EOT
Either `regional` or `global`.
If `regional` will be created as a normal, standalone DB.
If `global`, will be made part of a Global cluster (requires `global_cluster_identifier`).
EOT
default = "regional"
validation {
condition = contains(["regional", "global"], var.cluster_type)
error_message = "Allowed values: `regional` (standalone), `global` (part of global cluster)."
}
}
variable "global_cluster_identifier" {
type = string
description = "ID of the Aurora global cluster"
default = ""
}
variable "source_region" {
type = string
description = "Source Region of primary cluster, needed when using encrypted storage and region replicas"
default = ""
}
variable "iam_roles" {
type = list(string)
description = "Iam roles for the Aurora cluster"
default = []
}
variable "backtrack_window" {
type = number
description = "The target backtrack window, in seconds. Only available for aurora engine currently. Must be between 0 and 259200 (72 hours)"
default = 0
}
variable "enable_http_endpoint" {
type = bool
description = "Enable HTTP endpoint (data API). Only valid when engine_mode is set to serverless"
default = false
}
variable "vpc_security_group_ids" {
type = list(string)
description = "Additional security group IDs to apply to the cluster, in addition to the provisioned default security group with ingress traffic from existing CIDR blocks and existing security groups"
default = []
}
variable "ca_cert_identifier" {
description = "The identifier of the CA certificate for the DB instance"
type = string
default = null
}
variable "egress_enabled" {
description = "Whether or not to apply the egress security group rule to default security group, defaults to `true`"
type = bool
default = true
}
variable "enhanced_monitoring_attributes" {
description = "The attributes for the enhanced monitoring IAM role"
type = list(string)
default = ["enhanced-monitoring"]
}
variable "subnet_group_name" {
description = "Database subnet group name. Will use generated label ID if not supplied."
type = string
default = ""
}
variable "intra_security_group_traffic_enabled" {
type = bool
default = false
description = "Whether to allow traffic between resources inside the database's security group."
}
variable "activity_stream_enabled" {
type = bool
default = false
description = "Whether to enable Activity Streams"
}
variable "activity_stream_mode" {
type = string
default = "async"
description = "The mode for the Activity Streams. `async` and `sync` are supported. Defaults to `async`"
}
variable "activity_stream_kms_key_id" {
type = string
default = ""
description = "The ARN for the KMS key to encrypt Activity Stream Data data. When specifying `activity_stream_kms_key_id`, `activity_stream_enabled` needs to be set to true"
}
variable "parameter_group_name_prefix_enabled" {
type = bool
default = true
description = "Set to `true` to use `name_prefix` to name the cluster and database parameter groups. Set to `false` to use `name` instead"
}
variable "enable_global_write_forwarding" {
type = bool
default = false
description = "Set to `true`, to forward writes to an associated global cluster."
}