Skip to content

Commit 1925f03

Browse files
authored
feat: Add variables "enable_default_db", "enable_default_user" to module "safer_mysql" (#698)
1 parent 1f96fcc commit 1925f03

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

modules/safer_mysql/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ module "safer-mysql-db" {
261261
| disk\_size | The disk size for the master instance | `number` | `10` | no |
262262
| disk\_type | The disk type for the master instance. | `string` | `"PD_SSD"` | no |
263263
| edition | The edition of the instance, can be ENTERPRISE or ENTERPRISE\_PLUS. | `string` | `null` | no |
264+
| enable\_default\_db | Enable or disable the creation of the default database | `bool` | `true` | no |
265+
| enable\_default\_user | Enable or disable the creation of the default user | `bool` | `true` | no |
264266
| encryption\_key\_name | The full path to the encryption key used for the CMEK disk encryption | `string` | `null` | no |
265267
| follow\_gae\_application | A Google App Engine application whose zone to remain in. Must be in the same region as this instance. | `string` | `null` | no |
266268
| iam\_users | A list of IAM users to be created in your CloudSQL instance. iam.users.type can be CLOUD\_IAM\_USER, CLOUD\_IAM\_SERVICE\_ACCOUNT, CLOUD\_IAM\_GROUP and is required for type CLOUD\_IAM\_GROUP (IAM groups) | <pre>list(object({<br> id = string,<br> email = string,<br> type = optional(string)<br> }))</pre> | `[]` | no |

modules/safer_mysql/main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ module "safer_mysql" {
6060
allocated_ip_range = var.allocated_ip_range
6161
}
6262

63-
db_name = var.db_name
64-
db_charset = var.db_charset
65-
db_collation = var.db_collation
63+
enable_default_db = var.enable_default_db
64+
db_name = var.db_name
65+
db_charset = var.db_charset
66+
db_collation = var.db_collation
6667

6768
additional_databases = var.additional_databases
69+
enable_default_user = var.enable_default_user
6870
user_name = var.user_name
6971

7072
// All MySQL users can connect only via the Cloud SQL Proxy.

modules/safer_mysql/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ variable "read_replicas" {
258258
default = []
259259
}
260260

261+
variable "enable_default_db" {
262+
description = "Enable or disable the creation of the default database"
263+
type = bool
264+
default = true
265+
}
266+
261267
variable "db_name" {
262268
description = "The name of the default database to create"
263269
type = string
@@ -286,6 +292,12 @@ variable "additional_databases" {
286292
default = []
287293
}
288294

295+
variable "enable_default_user" {
296+
description = "Enable or disable the creation of the default user"
297+
type = bool
298+
default = true
299+
}
300+
289301
variable "user_name" {
290302
description = "The name of the default user"
291303
type = string

0 commit comments

Comments
 (0)