Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cloud sql instance for lnd #45

Merged
merged 2 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion modules/platform/gcp/cloud-sql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module "shared_pg" {
region = local.region
instance_name = "${local.name_prefix}-shared-pg"
destroyable_postgres = var.destroyable_postgres
highly_available = false
highly_available = local.shared_pg_ha
postgres_tier = local.postgres_tier

depends_on = [google_service_networking_connection.cloud_sql]
Expand All @@ -45,3 +45,33 @@ module "auth_pg" {

depends_on = [google_service_networking_connection.cloud_sql]
}

module "lnd_1_pg" {
count = local.deploy_lnd_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}-lnd-1-pg"
destroyable_postgres = var.destroyable_postgres
highly_available = false
postgres_tier = local.postgres_tier

depends_on = [google_service_networking_connection.cloud_sql]
}

module "lnd_2_pg" {
count = local.deploy_lnd_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}-lnd-2-pg"
destroyable_postgres = var.destroyable_postgres
highly_available = false
postgres_tier = local.postgres_tier

depends_on = [google_service_networking_connection.cloud_sql]
}
26 changes: 26 additions & 0 deletions modules/platform/gcp/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,29 @@ output "auth_pg_admin_password" {
value = local.deploy_auth_pg ? module.auth_pg.0.admin_password : ""
sensitive = true
}

output "lnd_1_pg_host" {
value = local.deploy_lnd_pg ? module.lnd_1_pg.0.private_ip : ""
}

output "lnd_1_pg_admin_username" {
value = local.deploy_lnd_pg ? module.lnd_1_pg.0.admin_username : ""
}

output "lnd_1_pg_admin_password" {
value = local.deploy_lnd_pg ? module.lnd_1_pg.0.admin_password : ""
sensitive = true
}

output "lnd_2_pg_host" {
value = local.deploy_lnd_pg ? module.lnd_2_pg.0.private_ip : ""
}

output "lnd_2_pg_admin_username" {
value = local.deploy_lnd_pg ? module.lnd_2_pg.0.admin_username : ""
}

output "lnd_2_pg_admin_password" {
value = local.deploy_lnd_pg ? module.lnd_2_pg.0.admin_password : ""
sensitive = true
}
8 changes: 8 additions & 0 deletions modules/platform/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ variable "postgres_tier" {
variable "destroyable_postgres" {
default = false
}
variable "shared_pg_ha" {
default = false
}
variable "deploy_shared_pg" {
default = true
}
variable "deploy_auth_pg" {
default = true
}
variable "deploy_lnd_pg" {
default = true
}
variable "node_service_account" {}
variable "min_default_node_count" {
default = 1
Expand All @@ -51,6 +57,8 @@ locals {
cluster_location = var.cluster_zone == "" ? local.region : "${local.region}-${var.cluster_zone}"
postgres_tier = var.postgres_tier
destroyable_postgres = var.destroyable_postgres
shared_pg_ha = var.shared_pg_ha
deploy_shared_pg = var.deploy_shared_pg
deploy_auth_pg = var.deploy_auth_pg
deploy_lnd_pg = var.deploy_lnd_pg
}