-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature proposal] first class support for procedures and function grants #99
Comments
Oh, I didn't know Example 1 has ever worked. Table is There are these things to solve:
If we have solution, I'd review & merge the fixes. |
@DerekTBrown I added some comments to find out what you think about some areas, but I don't have any serious issues with merging it. |
@petoju After reviewing your comments, I realized that my prior PR (#98) was going to make things way, way uglier (for instance, we could no have resource grants with no table, but with a procedure in the database field, ick). It is a much more involved change, but I have a PR for schematizing the various types of role grants, and adding support for procedures: |
@petoju thanks for reviewing!
Do you think it makes sense to introduce specific resource blocks, now that the "backend" separates between these? |
@DerekTBrown I'd merge them if the code was reused where possible, but I wouldn't like to delete the old ones in the near future. Users of this provider got used to them and refactoring is a lot of work. |
So, I just realized that between #98 and #102, I forgot to include tests for both Example 1 and Example 2. It looks like the new implementation has issues with Example 2, because it doesn't like a Procedure grant having a table:
The simplicity gains of #102 come from the fact that there is a 1:1 mapping between a |
Here is a fix: |
Re-opening: So, we definitely made a step closer to this by having different structs, but we need a different resource to truly make the code cleaner. |
Context
The deprecated Hashicorp Terraform provider supported role grants in a very clunky way:
It appears that some attempts have been made to preserve this functionality:
However, backwards compatibility (particularly Example 1) has been lost. Attempting to migrate directly from the upstream provider to the
petoju
one results in an error like the following:Moreover, this approach is incredibly hacky and hard to reason about. Here is my ugly attempt to provide backwards compatibility:
https://github.com/petoju/terraform-provider-mysql/pull/98/files
Proposal
To simplify the logic, I think it makes sense to provide a first-class
mysql_grant_procedure
andmysql_grant_function
resource. This would greatly simplify the amount of special-case logic, and provide a clearer interface for consumers.The text was updated successfully, but these errors were encountered: