-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
62 lines (51 loc) · 1.79 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
resource "kubernetes_namespace" "namespace" {
metadata {
name = var.namespace
}
}
// Feature
module "dbsync_feature" {
depends_on = [kubernetes_namespace.namespace]
source = "./feature"
namespace = var.namespace
operator_image_tag = var.operator_image_tag
metrics_delay = var.metrics_delay
dcu_per_second = var.dcu_per_second
postgres_password = var.postgres_password
postgres_secret_name = var.postgres_secret_name
pgbouncer_server_crt = var.pgbouncer_server_crt
pgbouncer_server_key = var.pgbouncer_server_key
postgres_hosts = coalesce(var.postgres_hosts, [for key in keys(var.cells) : "postgres-dbsync-v3-${key}"])
}
// Service
module "dbsync_service" {
depends_on = [kubernetes_namespace.namespace]
source = "./service"
namespace = var.namespace
}
// Cells
module "dbsync_cells" {
depends_on = [module.dbsync_feature]
for_each = var.cells
source = "./cell"
namespace = var.namespace
salt = each.key
// PVC
volume_name = each.value.pvc.volume_name
storage_size = each.value.pvc.storage_size
db_volume_claim = each.value.pvc.name
// PG
topology_zone = each.value.postgres.topology_zone
is_blockfrost_backend = each.value.postgres.is_blockfrost_backend
postgres_image_tag = each.value.postgres.image_tag
postgres_secret_name = var.postgres_secret_name
postgres_resources = each.value.postgres.resources
postgres_config_name = each.value.postgres.config_name
// PGBouncer
pgbouncer_image_tag = var.pgbouncer_image_tag
pgbouncer_replicas = each.value.pgbouncer.replicas
pgbouncer_auth_user_password = var.pgbouncer_auth_user_password
pgbouncer_reloader_image_tag = var.pgbouncer_reloader_image_tag
// Instances
instances = each.value.instances
}