-
Notifications
You must be signed in to change notification settings - Fork 1
/
google_sql.tf
54 lines (42 loc) · 1.27 KB
/
google_sql.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
resource "google_sql_database_instance" "polyaxon_postgres" {
project = var.gcp_project
region = var.gcp_region
name = var.sql_name
database_version = "POSTGRES_9_6"
settings {
availability_type = "ZONAL"
ip_configuration {
ipv4_enabled = false
private_network = google_compute_network.private_network.self_link
}
location_preference {
zone = var.gcp_zone
}
disk_size = var.sql_disk_size_gb
# NOTE from https://cloud.google.com/sql/docs/postgres/create-instance#machine-types
tier = var.sql_settings_tier
# Mailtenace will be done on 17:00-18:00 Monday JST
maintenance_window {
day = 1
hour = 8
update_track = "stable"
}
backup_configuration {
enabled = true
}
}
depends_on = [google_service_networking_connection.private_vpc_connection]
}
resource "google_sql_database" "polyaxon" {
project = var.gcp_project
name = "polyaxon"
instance = google_sql_database_instance.polyaxon_postgres.name
charset = "UTF8"
}
resource "google_sql_user" "user" {
project = var.gcp_project
name = "polyaxon"
instance = google_sql_database_instance.polyaxon_postgres.name
password = "polyaxon"
depends_on = [google_sql_database.polyaxon]
}