From 68f472aa8fcc10513f6e74059b120043fdcb4961 Mon Sep 17 00:00:00 2001 From: Rishi Kumar Date: Tue, 6 Aug 2024 12:04:44 +0530 Subject: [PATCH 1/4] fix: Disable read replica for ci errors --- examples/gcp/postgresql/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gcp/postgresql/main.tf b/examples/gcp/postgresql/main.tf index c7293817..1ba34d06 100644 --- a/examples/gcp/postgresql/main.tf +++ b/examples/gcp/postgresql/main.tf @@ -15,6 +15,6 @@ module "postgresql" { user_can_create_db = true databases = ["test"] replication = true - provision_read_replica = true + provision_read_replica = false upgradable = true } From 06b4047ab03d5d9175fc464c2986863a26eedce2 Mon Sep 17 00:00:00 2001 From: Rishi Kumar Date: Tue, 6 Aug 2024 12:05:15 +0530 Subject: [PATCH 2/4] fix: Grant get permissions to ci --- modules/inception/gcp/platform-roles.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/inception/gcp/platform-roles.tf b/modules/inception/gcp/platform-roles.tf index 049edabb..d51f8677 100644 --- a/modules/inception/gcp/platform-roles.tf +++ b/modules/inception/gcp/platform-roles.tf @@ -76,6 +76,7 @@ resource "google_project_iam_custom_role" "platform_make" { "apikeys.keys.update", "datamigration.connectionprofiles.create", "datamigration.connectionprofiles.delete", + "datamigration.connectionprofiles.get", ] } From 4f281246543b855d74c4fe2d6f69e6cd24cddb9a Mon Sep 17 00:00:00 2001 From: Rishi Kumar Date: Tue, 6 Aug 2024 12:14:11 +0530 Subject: [PATCH 3/4] chore: Set provision_read_replica to true --- examples/gcp/postgresql/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gcp/postgresql/main.tf b/examples/gcp/postgresql/main.tf index 1ba34d06..c7293817 100644 --- a/examples/gcp/postgresql/main.tf +++ b/examples/gcp/postgresql/main.tf @@ -15,6 +15,6 @@ module "postgresql" { user_can_create_db = true databases = ["test"] replication = true - provision_read_replica = false + provision_read_replica = true upgradable = true } From 3138b47f1a44692d603ca922c48e923d877614fb Mon Sep 17 00:00:00 2001 From: Rishi Kumar Date: Tue, 6 Aug 2024 12:14:54 +0530 Subject: [PATCH 4/4] feat: Conditionally set cloudsql.enable_pglogical on replicas --- modules/postgresql/gcp/read-replica.tf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/postgresql/gcp/read-replica.tf b/modules/postgresql/gcp/read-replica.tf index f2ae5b10..6d4f8a2f 100644 --- a/modules/postgresql/gcp/read-replica.tf +++ b/modules/postgresql/gcp/read-replica.tf @@ -12,6 +12,17 @@ resource "google_sql_database_instance" "replica" { tier = local.tier availability_type = local.highly_available ? "REGIONAL" : "ZONAL" + dynamic "database_flags" { + for_each = local.upgradable ? [{ + name = "cloudsql.enable_pglogical" + value = "on" + }] : [] + content { + name = database_flags.value.name + value = database_flags.value.value + } + } + dynamic "database_flags" { for_each = local.max_connections > 0 ? [local.max_connections] : [] content {