-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-database.tf
43 lines (36 loc) · 1.23 KB
/
03-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
38
39
40
41
42
43
resource "google_sql_database_instance" "db_instance" {
# GOTCHA: You need to make sure your api (services) are enabled before you can deploy resources
depends_on = [
"google_project_services.project",
]
project = "${google_project.project.id}"
name = "vibrato-postgres"
# Postgres Support is in BETA
database_version = "POSTGRES_9_6"
region = "us-central1"
settings {
# Second-generation instance tiers are based on the machine type.
tier = "db-f1-micro"
}
}
resource "google_sql_database" "users-db" {
# GOTCHA: You need to make sure your api (services) are enabled before you can deploy resources
depends_on = [
"google_project_services.project",
]
project = "${google_project.project.id}"
name = "users-db"
instance = "${google_sql_database_instance.db_instance.name}"
charset = "UTF8"
collation = "en_US.UTF8"
}
resource "google_sql_user" "users" {
# GOTCHA: You need to make sure your api (services) are enabled before you can deploy resources
depends_on = [
"google_project_services.project",
]
project = "${google_project.project.id}"
name = "db_user"
instance = "${google_sql_database_instance.db_instance.name}"
password = "${var.db_password}"
}