Skip to content

Commit 22c9f23

Browse files
committed
feat(postgres): support read pools
1 parent 3b07de8 commit 22c9f23

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

modules/postgresql/read_replica.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ resource "google_sql_database_instance" "replicas" {
3737
master_instance_name = google_sql_database_instance.default.name
3838
deletion_protection = var.read_replica_deletion_protection
3939
encryption_key_name = (join("-", slice(split("-", lookup(each.value, "zone", local.zone)), 0, 2))) == var.region ? null : each.value.encryption_key_name
40+
instance_type = lookup(each.value, "node_count", null) != null ? "READ_POOL_INSTANCE" : "READ_REPLICA_INSTANCE"
41+
node_count = lookup(each.value, "node_count", null)
4042

4143
settings {
4244
tier = lookup(each.value, "tier", null) == null ? var.tier : lookup(each.value, "tier", null)

modules/postgresql/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ variable "read_replicas" {
374374
})
375375
encryption_key_name = optional(string)
376376
data_cache_enabled = optional(bool)
377+
node_count = optional(number)
377378
}))
378379
default = []
379380
}

0 commit comments

Comments
 (0)