petoju / terraform-provider-mysql

Terraform MySQL provider – unofficial fork
https://registry.terraform.io/providers/petoju/mysql
Mozilla Public License 2.0
63 stars 40 forks source link

fix: bugs in resource grant conflicts #114

Closed DerekTBrown closed 3 months ago

DerekTBrown commented 4 months ago

What does this PR do?

This PR fixes two bugs I noticed related to resource grant conflicts:

  1. It is currently impossible to create multiple grants for the same user for different tables, because the ids conflict. This fixes the IDs to include the table or procedure name.

  2. If you try to create multiple conflicting resource grants, this may or may not be caught by the conflict detection logic because MySQL requests can be issued in parallel. This introduces a keyed mutex around grant creation and deletion to ensure that conflicts are caught.

Test Plan

Added unit tests

petoju commented 4 months ago

Could you please rebase your code against the latest master? That should help it pass the tests. It looks good otherwise.