-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.tf
42 lines (38 loc) · 1.5 KB
/
main.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
resource "aws_docdb_subnet_group" "docdb" {
name_prefix = var.name
subnet_ids = var.group_subnets
}
resource "aws_docdb_cluster" "docdb" {
cluster_identifier_prefix = var.name
db_subnet_group_name = aws_docdb_subnet_group.docdb.name
db_cluster_parameter_group_name = aws_docdb_cluster_parameter_group.docdb.name
vpc_security_group_ids = var.cluster_security_group
engine = var.engine
engine_version = var.engine_version
master_username = var.master_username
master_password = var.master_password
storage_encrypted = var.storage_encrypted
apply_immediately = var.apply_immediately
backup_retention_period = var.backup_retention_period
preferred_backup_window = var.preferred_backup_window
skip_final_snapshot = var.skip_final_snapshot
}
resource "aws_docdb_cluster_instance" "cluster_instances" {
count = var.cluster_instance_count
identifier = "${var.name}-${count.index}"
cluster_identifier = aws_docdb_cluster.docdb.id
instance_class = var.cluster_instance_class
ca_cert_identifier = var.ca_cert_identifier
}
resource "aws_docdb_cluster_parameter_group" "docdb" {
family = var.family
name_prefix = var.name
description = "${var.name} docdb cluster parameter group"
dynamic "parameter" {
for_each = var.parameters
content {
name = parameter.value.name
value = parameter.value.value
}
}
}