-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.tf
More file actions
51 lines (46 loc) · 1.86 KB
/
main.tf
File metadata and controls
51 lines (46 loc) · 1.86 KB
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
resource "flexibleengine_rds_parametergroup_v3" "parametergroup" {
count = length(var.rds_parametergroup_values) > 0 ? 1 : 0
name = "parametergroup-${var.rds_instance_name}"
description = "RDS Parameter Group"
values = var.rds_parametergroup_values
datastore {
type = lower(var.db_type)
version = var.db_version
}
}
resource "flexibleengine_rds_instance_v3" "instance" {
availability_zone = var.rds_instance_az
db {
password = var.db_root_password
type = var.db_type
version = var.db_version
port = var.db_tcp_port
}
name = var.rds_instance_name
security_group_id = var.secgroup_id
subnet_id = var.subnet_id
vpc_id = var.vpc_id
volume {
type = var.rds_instance_volume_type
size = var.rds_instance_volume_size
disk_encryption_id = var.rds_instance_volume_encryption_id
}
flavor = var.db_flavor
ha_replication_mode = var.rds_ha_enable ? var.rds_ha_replicamode : null
backup_strategy {
start_time = var.db_backup_starttime
keep_days = var.db_backup_keepdays
}
param_group_id = length(var.rds_parametergroup_values) > 0 ? flexibleengine_rds_parametergroup_v3.parametergroup.*.id[0] : null
}
resource "flexibleengine_rds_read_replica_v3" "instances" {
count = length(var.rds_read_replicat_list) > 0 ? length(var.rds_read_replicat_list) : 0
name = var.rds_read_replicat_list[count.index]["name"]
flavor = var.rds_read_replicat_list[count.index]["flavor"]
availability_zone = var.rds_read_replicat_list[count.index]["availability_zone"]
replica_of_id = flexibleengine_rds_instance_v3.instance.id
volume {
type = var.rds_read_replicat_list[count.index]["volume_type"]
disk_encryption_id = var.rds_read_replicat_list[count.index]["disk_encryption_id"]
}
}