Skip to content

Instantly share code, notes, and snippets.

@noamt
Created February 7, 2020 09:25
Show Gist options
  • Save noamt/8cbdcf9697d2c81eb5e149f9dd6eb216 to your computer and use it in GitHub Desktop.
Save noamt/8cbdcf9697d2c81eb5e149f9dd6eb216 to your computer and use it in GitHub Desktop.
For blog post "Highly available, read-replicated PostgreSQL with Google CloudSQL and Terraform"
resource "google_sql_database_instance" "read_replica" {
name = "replica-${random_id.db_name_suffix.hex}"
master_instance_name = "${var.project_id}:${google_sql_database_instance.master.name}"
region = "europe-west4"
database_version = "POSTGRES_11"
replica_configuration {
failover_target = false
}
settings {
tier = "db-f1-micro"
availability_type = "ZONAL"
disk_size = "100"
backup_configuration {
enabled = false
}
ip_configuration {
ipv4_enabled = true
private_network = "projects/${var.project_id}/global/networks/default"
}
location_preference {
zone = "europe-west4-a"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment