-
Notifications
You must be signed in to change notification settings - Fork 1
/
sql_db.tf
57 lines (48 loc) · 1.61 KB
/
sql_db.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
55
56
locals {
db_region = var.db_region != "" ? var.db_region : var.region
}
module "sql_db" {
source = "GoogleCloudPlatform/sql-db/google//modules/postgresql"
version = "21.0.0"
name = format("%s-db", var.prefix)
random_instance_name = true
project_id = var.project_id
database_version = "POSTGRES_16"
region = local.db_region
// Master configurations
tier = "db-custom-2-7680"
zone = local.db_master_zone
availability_type = "REGIONAL"
maintenance_window_day = 7
maintenance_window_hour = 12
maintenance_window_update_track = "stable"
deletion_protection = false
ip_configuration = {
ipv4_enabled = false
require_ssl = true
private_network = module.vpc.network_self_link
allocated_ip_range = module.private_service_access.google_compute_global_address_name
authorized_networks = [
]
}
backup_configuration = {
enabled = true
start_time = "00:00"
location = null
point_in_time_recovery_enabled = false
transaction_log_retention_days = null
retained_backups = 14
retention_unit = "COUNT"
}
db_name = "tabnine"
db_charset = "UTF8"
db_collation = "en_US.UTF8"
user_name = "tabnine"
depends_on = [
module.private_service_access.peering_completed
]
}
resource "google_sql_ssl_cert" "sql_db" {
common_name = "tabnine-cloud"
instance = module.sql_db.instance_name
}