mysql_user

The mysql_user resource creates and manages a user on a MySQL server.

Example Usage

resource "mysql_user" "jdoe" {
  user               = "jdoe"
  host               = "example.com"
  plaintext_password = "password"
}

Example Usage with an Authentication Plugin

resource "mysql_user" "nologin" {
  user               = "nologin"
  host               = "example.com"
  auth_plugin        = "mysql_no_login"
}

Argument Reference

The following arguments are supported:

  • user - (Required) The name of the user.

  • host - (Optional) The source host of the user. Defaults to "localhost".

  • plaintext_password - (Optional) The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with auth_plugin.

  • password - (Optional) Deprecated alias of plaintext_password, whose value is stored as plaintext in state. Prefer to use plaintext_password instead, which stores the password as an unsalted hash. Conflicts with auth_plugin.

  • auth_plugin - (Optional) Use an authentication plugin to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with password and plaintext_password.

The auth_plugin value supports:

  • AWSAuthenticationPlugin - Allows the use of IAM authentication with Amazon Aurora. For more details on how to use IAM auth with Aurora, see here.

  • mysql_no_login - Uses the MySQL No-Login Authentication Plugin. The No-Login Authentication Plugin must be active in MySQL. For more information, see here.

Attributes Reference

No further attributes are exported.

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/mysql/r/user.html