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

Error creating grant in MySQL 8 ( Azure Flexible Mysql) #132

Open tperryba opened 2 months ago

tperryba commented 2 months ago

Provider version

provider registry.terraform.io/petoju/mysql v3.0.54

Terraform Configuration Files

In the ideal case, provide narrowed-down reproducer of your case. This should be a complete module with config connecting to localhost demonstrating the issue.

If you can, provide also docker command-line or docker-compose file starting mysql, which lead to the issue. That will remove any ambiguity regarding versions of tools and so on.

resource "mysql_grant" "magento_grant" {
  user       = random_pet.mysql_db_user.id  
  host       = "%"
  database   = local.mysql_db_name
  privileges = ["ALL"]
  depends_on = [mysql_user.magento_user, mysql_database.magento_db]
}

Debug Output

2024-04-09T10:51:29.849-0400 [DEBUG] provider: using plugin: version=5 2024-04-09T10:51:29.854-0400 [WARN] ValidateProviderConfig from "provider[\"registry.terraform.io/petoju/mysql\"]" changed the config value, but that value is unused 2024-04-09T10:51:29.856-0400 [WARN] Provider "registry.terraform.io/petoju/mysql" produced an invalid plan for mysql_grant.magento_grant, but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations:

Expected Behavior

To not error, it appears that the grant is created though, but it is not in the terraform state file, which causes other downstream management issues.

Actual Behavior

It seems to work on a brand new first run, however all subsequent runs it fails. Grant is getting created, but then it throws an error.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

This is running in Azure against a Azure Flexible Mysql Server

petoju commented 2 months ago

@tperryba as a temporary fix - setting privileges to "ALL PRIVILEGES" instead of "ALL" could help.

But it also needs to be fixed in the code.

petoju commented 2 months ago

@tperryba could you please provide log also from 3.0.57? That has a bit better logging (no other significant changes) - and the better logs could help.