petoju / terraform-provider-mysql

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

Unable to Execute `ALTER USER ... DEFAULT ROLE ALL` by mysql_default_roles #178

Open kei500 opened 3 weeks ago

kei500 commented 3 weeks ago

Provider version

Terraform v1.9.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.70.0
+ provider registry.terraform.io/petoju/mysql v3.0.65

MySQL version and settings

Aurora MySQL version 3.05.2, compatible with MySQL 8.0.32. There aren't any non-standard settings.

Terraform Configuration Files

resource "mysql_default_roles" "exmaple" {
  user  = "example"
  host  = "%"
  roles = ["ALL"]
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

What expect that following SQL is executed.

ALTER USER 'example'@'%' DEFAULT ROLE ALL;

Actual Behavior

An error occured:

│ Error: failed to update user default roles: failed executing SQL: Error 3530 (HY000): `ALL`@`%` is not granted to `exmaple`@`%`

I guess that stopping to add this single quotation in the case of ALL will resolve this issue.

Steps to Reproduce

  1. terraform apply

Important Factoids

N/A

References

N/A

petoju commented 3 weeks ago

Yes, this is a special case, that needs to be fixed. Could you send a PR?