File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
2424| disk\_ autoresize | Configuration to increase storage size | bool | ` "true" ` | no |
2525| disk\_ size | The disk size for the master instance | number | ` "10" ` | no |
2626| disk\_ type | The disk type for the master instance. | string | ` "PD_SSD" ` | no |
27+ | enable\_ default\_ db | Enable or disable the creation of the default database | bool | ` "true" ` | no |
28+ | enable\_ default\_ user | Enable or disable the creation of the default user | bool | ` "true" ` | no |
2729| encryption\_ key\_ name | The full path to the encryption key used for the CMEK disk encryption | string | ` "null" ` | no |
2830| ip\_ configuration | The ip_configuration settings subblock | object | ` <map> ` | no |
2931| maintenance\_ window\_ day | The day of week (1-7) for the master instance maintenance. | number | ` "1" ` | no |
Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ resource "google_sql_database_instance" "default" {
121121}
122122
123123resource "google_sql_database" "default" {
124+ count = var. enable_default_db ? 1 : 0
124125 name = var. db_name
125126 project = var. project_id
126127 instance = google_sql_database_instance. default . name
@@ -149,6 +150,7 @@ resource "random_id" "user-password" {
149150}
150151
151152resource "google_sql_user" "default" {
153+ count = var. enable_default_user ? 1 : 0
152154 name = var. user_name
153155 project = var. project_id
154156 instance = google_sql_database_instance. default . name
Original file line number Diff line number Diff line change @@ -291,3 +291,15 @@ variable "read_replica_deletion_protection" {
291291 type = bool
292292 default = false
293293}
294+
295+ variable "enable_default_db" {
296+ description = " Enable or disable the creation of the default database"
297+ type = bool
298+ default = true
299+ }
300+
301+ variable "enable_default_user" {
302+ description = " Enable or disable the creation of the default user"
303+ type = bool
304+ default = true
305+ }
You can’t perform that action at this time.
0 commit comments