-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdatabase.tf
37 lines (29 loc) · 1.04 KB
/
database.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Postgres database.
resource "google_sql_database_instance" "serverpod" {
name = "serverpod-${var.runmode}-database"
database_version = var.database_version
region = var.region
settings {
tier = var.database_tier
availability_type = var.database_availability_type
backup_configuration {
enabled = var.database_backup_enabled
point_in_time_recovery_enabled = var.database_backup_point_in_time_recovery_enabled
}
ip_configuration {
ipv4_enabled = true
private_network = google_compute_network.serverpod.id
}
}
deletion_protection = var.database_deletion_protection
depends_on = [google_service_networking_connection.private-vpc-connection]
}
resource "google_sql_database" "serverpod" {
name = "serverpod"
instance = google_sql_database_instance.serverpod.name
}
resource "google_sql_user" "serverpod" {
name = "postgres"
password = var.database_password
instance = google_sql_database_instance.serverpod.name
}