From 90a56acd6a2c3bfd01d595b7a2e3b7df5f72f3a9 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Mon, 16 Sep 2024 07:40:59 +0000 Subject: [PATCH] chore!: remove shared pg (#219) * chore!: remove shared pg * chore: cleanup more config --- examples/gcp/platform/main.tf | 5 -- modules/platform/gcp/cloud-sql.tf | 12 ----- modules/platform/gcp/cloud-sql/main.tf | 70 -------------------------- modules/platform/gcp/outputs.tf | 21 -------- modules/platform/gcp/variables.tf | 8 --- 5 files changed, 116 deletions(-) delete mode 100644 modules/platform/gcp/cloud-sql.tf delete mode 100644 modules/platform/gcp/cloud-sql/main.tf diff --git a/examples/gcp/platform/main.tf b/examples/gcp/platform/main.tf index 08aadfaf..b334159b 100644 --- a/examples/gcp/platform/main.tf +++ b/examples/gcp/platform/main.tf @@ -7,9 +7,6 @@ variable "node_default_machine_type" { variable "letsencrypt_issuer_email" { default = "bot@galoy.io" } -variable "destroyable_postgres" { - default = false -} variable "destroyable_cluster" { default = false } @@ -23,8 +20,6 @@ module "platform" { node_service_account = var.node_service_account node_default_machine_type = var.node_default_machine_type destroyable_cluster = var.destroyable_cluster - destroyable_postgres = var.destroyable_postgres - deploy_shared_pg = false } output "cluster_endpoint" { diff --git a/modules/platform/gcp/cloud-sql.tf b/modules/platform/gcp/cloud-sql.tf deleted file mode 100644 index ebd60997..00000000 --- a/modules/platform/gcp/cloud-sql.tf +++ /dev/null @@ -1,12 +0,0 @@ -module "shared_pg" { - count = local.deploy_shared_pg ? 1 : 0 - source = "./cloud-sql" - - project = local.project - vpc_id = data.google_compute_network.vpc.id - region = local.region - instance_name = "${local.name_prefix}-shared-pg" - destroyable_postgres = var.destroyable_postgres - highly_available = local.pg_ha - postgres_tier = local.postgres_tier -} diff --git a/modules/platform/gcp/cloud-sql/main.tf b/modules/platform/gcp/cloud-sql/main.tf deleted file mode 100644 index 357cd73e..00000000 --- a/modules/platform/gcp/cloud-sql/main.tf +++ /dev/null @@ -1,70 +0,0 @@ -variable "project" {} -variable "vpc_id" {} -variable "region" {} -variable "instance_name" {} -variable "destroyable_postgres" {} -variable "highly_available" {} -variable "postgres_tier" {} - -resource "random_id" "db_name_suffix" { - byte_length = 4 -} - -resource "google_sql_database_instance" "instance" { - name = "${var.instance_name}-${random_id.db_name_suffix.hex}" - - project = var.project - database_version = "POSTGRES_14" - region = var.region - deletion_protection = !var.destroyable_postgres - - settings { - tier = var.postgres_tier - availability_type = var.highly_available ? "REGIONAL" : "ZONAL" - - database_flags { - name = "max_connections" - value = 100 - } - - backup_configuration { - enabled = true - point_in_time_recovery_enabled = true - } - - ip_configuration { - ipv4_enabled = true - private_network = var.vpc_id - } - } -} - -resource "random_password" "admin" { - length = 20 - special = false -} - -resource "google_sql_user" "admin" { - name = "${var.instance_name}-admin" - instance = google_sql_database_instance.instance.name - password = random_password.admin.result - project = var.project -} - -output "instance_name" { - value = google_sql_database_instance.instance.name -} - -output "admin_username" { - value = google_sql_user.admin.name -} -output "admin_password" { - value = random_password.admin.result -} -output "private_ip" { - value = google_sql_database_instance.instance.private_ip_address -} - -output "connection_name" { - value = google_sql_database_instance.instance.connection_name -} diff --git a/modules/platform/gcp/outputs.tf b/modules/platform/gcp/outputs.tf index 1f5e8cdf..716b5a57 100644 --- a/modules/platform/gcp/outputs.tf +++ b/modules/platform/gcp/outputs.tf @@ -29,24 +29,3 @@ output "lnd1_internal_ip" { output "lnd2_internal_ip" { value = local.deploy_lnd_ips ? google_compute_address.lnd2_internal_ip[0].address : "" } - -output "shared_pg_host" { - value = local.deploy_shared_pg ? module.shared_pg.0.private_ip : "" -} - -output "shared_pg_admin_username" { - value = local.deploy_shared_pg ? module.shared_pg.0.admin_username : "" -} - -output "shared_pg_admin_password" { - value = local.deploy_shared_pg ? module.shared_pg.0.admin_password : "" - sensitive = true -} - -output "shared_pg_instance_name" { - value = local.deploy_shared_pg ? module.shared_pg.0.instance_name : "" -} - -output "shared_pg_connection_name" { - value = local.deploy_shared_pg ? module.shared_pg.0.connection_name : "" -} diff --git a/modules/platform/gcp/variables.tf b/modules/platform/gcp/variables.tf index ffa56566..a9ef8fe0 100644 --- a/modules/platform/gcp/variables.tf +++ b/modules/platform/gcp/variables.tf @@ -21,15 +21,9 @@ variable "destroyable_cluster" { variable "postgres_tier" { default = "db-f1-micro" } -variable "destroyable_postgres" { - default = false -} variable "pg_ha" { default = false } -variable "deploy_shared_pg" { - default = true -} variable "node_service_account" {} variable "min_default_node_count" { default = 1 @@ -58,8 +52,6 @@ locals { max_default_node_count = var.max_default_node_count cluster_location = var.cluster_zone == "" ? local.region : "${local.region}-${var.cluster_zone}" postgres_tier = var.postgres_tier - destroyable_postgres = var.destroyable_postgres pg_ha = var.pg_ha - deploy_shared_pg = var.deploy_shared_pg deploy_lnd_ips = var.deploy_lnd_ips }