-
Notifications
You must be signed in to change notification settings - Fork 19
/
db.tf
49 lines (41 loc) · 1.24 KB
/
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
resource "google_sql_database_instance" "striim-db" {
project = google_project.striim_project.id
name = "striim-db"
database_version = var.cloud_sql_version
region = var.striim-region
deletion_protection = false
settings {
tier = var.striim-db-type
availability_type = "REGIONAL"
user_labels = {
automated = true
application = "striim"
}
ip_configuration {
ipv4_enabled = false
private_network = google_compute_subnetwork.striim-vpc-subnet.network
}
backup_configuration {
enabled = true
start_time = "06:00"
}
}
timeouts {
create = "30m"
}
depends_on = [google_project.striim_project]
}
resource "google_sql_user" "striim" {
project = google_project.striim_project.id
name = "striim"
instance = google_sql_database_instance.striim-db.name
password = "changeme1"
}
resource "google_sql_database" "striim" {
project = google_project.striim_project.id
name = "striim"
instance = google_sql_database_instance.striim-db.name
# This fake dependency prevents destroy failures -- for whatever reason the db must be deleted
# before the user
depends_on = [google_sql_user.striim]
}