hashicorp/terraform-provider-mysql

Feature: Support tls_options for user and grant

jochen42 opened this issue · 1 comments

Hi together,

we want to manage our sql-users with terraform. But we have several users, where we need to require ssl-connections. MySQL supports tls_options for the GRANT-statement and the CREATE USER-Statement.
More details here:
https://dev.mysql.com/doc/refman/5.7/en/create-user.html#create-user-tls

Affected Resource(s)

  • mysql_user
  • mysql_grant

Suggestion for hcl-syntax

resource "mysql_user" "read-only-user" {
  user = "read-only-user"
  host = "%"
  password = "passwordpasswordpassword"
  tls_options = "SSL"
}
resource "mysql_grant" "read-only-user" {
  user = "read-only-user"
  host  = "localhost:3306"
  database = "%"
  privileges = ["SELECT", "SHOW DATABASES", "SHOW VIEW"]
  tls_options = "SSL"
}

Expected Behavior

If we have this option in the hcl, the plugin should append the "REQUIRE " to the SQL-Statement.

Closing this out now that #41 is merged and #43 is in PR.