-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcloudsql.tf
More file actions
34 lines (29 loc) · 866 Bytes
/
cloudsql.tf
File metadata and controls
34 lines (29 loc) · 866 Bytes
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
resource "random_integer" "hive_metastore_number" {
min = 10000
max = 99999
}
resource "google_sql_database_instance" "hive_metastore_instance" {
region = "${var.region}"
name = "${var.project}-hive-metastore-${random_integer.hive_metastore_number.result}"
database_version = "${var.database_version}"
settings {
tier = "db-n1-standard-1"
activation_policy = "ALWAYS"
location_preference {
zone = "${var.zone}"
}
}
}
//Create a user because terraform deletes the default root user that comes with the mysql instance
resource "google_sql_user" "sql_user" {
name = "root"
instance = "${google_sql_database_instance.hive_metastore_instance.name}"
project = "${var.project}"
password = "changeme"
host = "%"
lifecycle {
ignore_changes = [
"password",
]
}
}