Skip to content

terraform module that allow to manage mysql users and databases via module

License

Notifications You must be signed in to change notification settings

dmytro-dorofeiev/terraform-mysql-user-module

Repository files navigation

Terraform module mysql

About

This module allows to manage database and user.

Example

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
}

Requirements

Name Version
mysql 1.10.5

Providers

Name Version
mysql 1.10.5

Modules

No modules.

Resources

Name Type
mysql_database.this resource
mysql_grant.this resource
mysql_user.this resource

Inputs

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)
[
"ALL PRIVILEGES"
]
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

Outputs

Name Description
db_name The name of the database.
mysql_user_id The id of the user created, composed as username@host

About

terraform module that allow to manage mysql users and databases via module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages