hashicorp / terraform-provider-mysql

Terraform MySQL provider – This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
https://www.terraform.io/docs/providers/mysql/
Mozilla Public License 2.0
61 stars 189 forks source link

Feature: Support MariaDB roles #8

Open hashibot opened 7 years ago

hashibot commented 7 years ago

This issue was originally opened by @taiidani as hashicorp/terraform#15007. It was migrated here as part of the provider split. The original body of the issue is below.


Terraform Version

v0.9.6

Affected Resource(s)

Although this is technically a feature request for something like mysql_grant_role, assuming you want to reuse the existing provider for MariaDB-specific functionality.

Terraform Configuration Files

If the existing mysql_grant were used it would look something like this:

resource "mysql_grant" "user" {
  user       = "user"
  host       = "host"
  database   = "app"
  privileges = ["job_developer"]
}

For a brand new resource I'd expect something more like this:

resource "mysql_grant_role" "user" {
  user       = "user"
  host       = "host"
  roles = ["job_developer"]
}

Expected Behavior

Terraform should issue a GRANT ROLE job_developer to user to MariaDB.

Actual Behavior

When using mysql_grant:

* mysql_grant.user: Received hashicorp/terraform#1064 error from MySQL server: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on app.* TO 'user'@'%'' at line 1"
joestump commented 6 years ago

48 adds both a mysql_role resource as well as adding role and roles to the mysql_grant resource. I think this should address this use case. 👍