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 tls_options for user and grant #40

Closed jochen42 closed 6 years ago

jochen42 commented 6 years ago

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)

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.

joestump commented 6 years ago

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