1
1
resource "kubernetes_namespace" "namespace" {
2
+ for_each = var. enable_postgres ? { " enabled" = true } : {}
2
3
metadata {
3
4
name = var. namespace
4
5
}
@@ -8,6 +9,7 @@ resource "kubernetes_namespace" "namespace" {
8
9
module "dbsync_feature" {
9
10
depends_on = [kubernetes_namespace . namespace ]
10
11
source = " ./feature"
12
+ for_each = var. enable_postgres ? { " enabled" = true } : {}
11
13
12
14
namespace = var. namespace
13
15
operator_image_tag = var. operator_image_tag
@@ -23,10 +25,10 @@ module "dbsync_feature" {
23
25
24
26
// Service
25
27
module "dbsync_service" {
26
- depends_on = [kubernetes_namespace . namespace ]
27
- source = " ./service"
28
-
29
- namespace = var. namespace
28
+ depends_on = [kubernetes_namespace . namespace ]
29
+ source = " ./service"
30
+ cloud_provider = var . cloud_provider
31
+ namespace = var. namespace
30
32
}
31
33
32
34
// Cells
@@ -35,27 +37,36 @@ module "dbsync_cells" {
35
37
for_each = var. cells
36
38
source = " ./cell"
37
39
38
- namespace = var. namespace
39
- salt = each. key
40
+ namespace = var. namespace
41
+ salt = each. key
42
+ enable_postgres = var. enable_postgres
43
+ enable_pgbouncer = var. enable_pgbouncer
40
44
41
45
// PVC
42
- volume_name = each. value . pvc . volume_name
43
- storage_size = each. value . pvc . storage_size
44
- db_volume_claim = each. value . pvc . name
45
-
46
- // PG
47
- topology_zone = each. value . postgres . topology_zone
48
- is_blockfrost_backend = each. value . postgres . is_blockfrost_backend
49
- postgres_image_tag = each. value . postgres . image_tag
50
- postgres_secret_name = var. postgres_secret_name
51
- postgres_resources = each. value . postgres . resources
52
- postgres_config_name = each. value . postgres . config_name
53
-
54
- // PGBouncer
55
- pgbouncer_image_tag = var. pgbouncer_image_tag
56
- pgbouncer_replicas = each. value . pgbouncer . replicas
57
- pgbouncer_auth_user_password = var. pgbouncer_auth_user_password
58
- pgbouncer_reloader_image_tag = var. pgbouncer_reloader_image_tag
46
+ access_mode = each. value . pvc . access_mode
47
+ db_volume_claim = each. value . pvc . name
48
+ storage_class_name = each. value . pvc . storage_class_name
49
+ storage_size = each. value . pvc . storage_size
50
+ volume_name = each. value . pvc . volume_name
51
+
52
+ // PG: conditionally defined if each cell has a postgres key
53
+ topology_zone = each. value . postgres != null ? each. value . postgres . topology_zone : null
54
+ is_blockfrost_backend = each. value . postgres != null ? each. value . postgres . is_blockfrost_backend : null
55
+ postgres_image_tag = each. value . postgres != null ? each. value . postgres . image_tag : null
56
+ postgres_secret_name = each. value . postgres != null ? var. postgres_secret_name : null
57
+ postgres_resources = each. value . postgres != null ? each. value . postgres . resources : null
58
+ postgres_config_name = each. value . postgres != null ? each. value . postgres . config_name : null
59
+ postgres_tolerations = each. value . postgres != null ? each. value . postgres . tolerations : null
60
+
61
+ // PGBouncer: conditionally defined if each cell has a pgbouncer key
62
+ certs_secret_name = each. value . pgbouncer != null ? each. value . pgbouncer . certs_secret_name : null
63
+ pgbouncer_cloud_provider = each. value . pgbouncer != null ? var. cloud_provider : null
64
+ pgbouncer_image_tag = each. value . pgbouncer != null ? var. pgbouncer_image_tag : null
65
+ pgbouncer_load_balancer = each. value . pgbouncer != null ? each. value . pgbouncer . load_balancer : null
66
+ pgbouncer_replicas = each. value . pgbouncer != null ? each. value . pgbouncer . replicas : null
67
+ pgbouncer_auth_user_password = each. value . pgbouncer != null ? var. pgbouncer_auth_user_password : null
68
+ pgbouncer_reloader_image_tag = each. value . pgbouncer != null ? var. pgbouncer_reloader_image_tag : null
69
+ pgbouncer_tolerations = each. value . pgbouncer != null ? each. value . pgbouncer . tolerations : null
59
70
60
71
// Instances
61
72
instances = each. value . instances
0 commit comments