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 187 forks source link

Allow wildcards on GRANT statements by escaping database names #45

Closed joestump closed 6 years ago

joestump commented 6 years ago

What does this PR change?

Adds escaping to the database attribute so wildcards can be used. Fixes #20. Thanks to @krogon-dp for getting the ball rolling. I refactored it a little.

Test output

MYSQL_ENDPOINT="localhost" MYSQL_USERNAME="root" MYSQL_PASSWORD="" make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v  -timeout 120m
?       github.com/terraform-providers/terraform-provider-mysql [no test files]
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccDatabase
--- PASS: TestAccDatabase (0.04s)
=== RUN   TestAccDatabase_collationChange
--- PASS: TestAccDatabase_collationChange (0.05s)
=== RUN   TestAccGrant
--- PASS: TestAccGrant (0.07s)
=== RUN   TestAccUser_basic
--- PASS: TestAccUser_basic (0.08s)
=== RUN   TestAccUser_auth
--- PASS: TestAccUser_auth (0.03s)
=== RUN   TestAccUser_deprecated
--- PASS: TestAccUser_deprecated (0.05s)
PASS
ok      github.com/terraform-providers/terraform-provider-mysql/mysql   0.429s
joestump commented 6 years ago

@paultyng good call. I've got another PR that I'm adding tests to and will add something there.