Skip to content

Commit

Permalink
fix: Use depends_on to address the dependency of pg replica on pg master
Browse files Browse the repository at this point in the history
  • Loading branch information
k3yss committed Jun 15, 2024
1 parent 22af1d7 commit 5e21ef6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/gcp/postgresql/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
variable "name_prefix" {}
variable "vpc_name_prefix" {}
variable "gcp_project" {}
variable "destroyable_postgres" {
default = false
Expand All @@ -9,6 +10,7 @@ module "postgresql" {
# source = "../../../modules/postgresql/gcp"

instance_name = "${var.name_prefix}-pg"
vpc_name = "${var.vpc_name_prefix}-vpc"
vpc_name = "${var.name_prefix}-vpc"
gcp_project = var.gcp_project
destroyable = var.destroyable_postgres
Expand Down
1 change: 1 addition & 0 deletions modules/postgresql/gcp/read-replica.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ resource "google_sql_database_instance" "replica" {
database_version = "POSTGRES_14"
region = local.region
deletion_protection = !local.destroyable
depends_on = [google_sql_database_instance.instance]

settings {
tier = local.tier
Expand Down

0 comments on commit 5e21ef6

Please sign in to comment.