Files
opentf/website/source/docs/providers/mysql/r/grant.html.markdown
Joe Topjian 8623803dd7 provider/mysql: user and grant resources (#7656)
* provider/mysql: User Resource

This commit introduces a mysql_user resource. It includes basic
functionality of adding a user@host along with a password.

* provider/mysql: Grant Resource

This commit introduces a mysql_grant resource. It can grant a set
of privileges to a user against a whole database.

* provider/mysql: Adding documentation for user and grant resources
2016-07-26 19:19:39 +01:00

1.3 KiB

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
mysql MySQL: mysql_grant docs-mysql-resource-grant Creates and manages privileges given to a user on a MySQL server

mysql_grant

The mysql_grant resource creates and manages privileges given to a user on a MySQL server.

Example Usage

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

resource "mysql_grant" "jdoe" {
    user = "${mysql_user.jdoe.user}"
    host = "${mysql_user.jdoe.host}"
    database = "app"
    privileges = ["SELECT", "UPDATE"]
}

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".

  • database - (Required) The database to grant privileges on. At this time, privileges are given to all tables on the database (mydb.*).

  • privileges - (Required) A list of privileges to grant to the user. Refer to a list of privileges (such as here) for applicable privileges.

  • grant - (Optional) Whether to also give the user privileges to grant the same privileges to other users.

Attributes Reference

No further attributes are exported.