This module allows to manage database and user.
provider "mysql" {
alias = "mydb"
endpoint = var.mysql_server_endpoint
username = var.mysql_root_username
password = var.mysql_root_password
}
module "mysql_user" {
source = "git::https://github.com/dmytro-dorofeiev/modules/terraform-mysql-user"
providers = {
mysql = mysql.mydb
}
create_db = true
db_name = var.db_name
db_username = var.db_username
db_host = var.db_host
db_user_password = var.db_user_password
db_user_privileges = var.db_user_privileges
db_table = var.db_table
}
Name | Version |
---|---|
mysql | 1.10.5 |
Name | Version |
---|---|
mysql | 1.10.5 |
No modules.
Name | Type |
---|---|
mysql_database.this | resource |
mysql_grant.this | resource |
mysql_user.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
create_db | Should database be created? | bool |
true |
no |
db_host | The source host of the user. | string |
"%" |
no |
db_name | The name of the database. | string |
n/a | yes |
db_table | Which table to grant privileges on. | string |
"*" |
no |
db_user_password | The user password for the database | string |
n/a | yes |
db_user_privileges | A list of privileges to grant to the user. Refer to a list of privileges (such as here) for applicable privileges | list(string) |
[ |
no |
db_username | The name of the user. | string |
n/a | yes |
default_character_set | The default character set to use when a table is created without specifying an explicit character set. | string |
"utf8" |
no |
default_collation | The default collation to use when a table is created without specifying an explicit collation. | string |
"utf8_general_ci" |
no |
Name | Description |
---|---|
db_name | The name of the database. |
mysql_user_id | The id of the user created, composed as username@host |