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

MariaDB is not supported with ANSI_QUOTES #137

Closed vfouqueron closed 2 months ago

vfouqueron commented 2 months ago

Hi there,

please follow these steps to ensure quick resolution of your issue.

The maintainer (petoju) manages this project in a free time and thus doesn't have plenty of time to resolve all the issues. With that mentioned, PRs are always welcome.

Provider version

3.0.55

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_database" "app" {
  default_character_set = "utf8mb4"
  default_collation     = "utf8mb4_unicode_ci"
  name                  = "grafana-on-call"
}

resource "mysql_user" "grafana_on_call" {
  user               = "grafana-on-call"
  host               = var.nodes_url
  plaintext_password = random_password.mysql.result
  tls_option         = "SSL"
}

resource "mysql_grant" "grafana_on_call" {
  user       = mysql_user.grafana_on_call.user
  host       = mysql_user.grafana_on_call.host
  database   = mysql_database.app.name
  privileges = [
    "DELETE",
    "INSERT",
    "SELECT",
    "UPDATE"
  ]
}

Debug Output

https://gist.github.com/vfouqueron/b9ef6a1b6494d3d64da5b9eaf842e764

Expected Behavior

The created user get his grant created with success

Actual Behavior

Terraform output this error:

| Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ module.applications.module.grafana-on-call.mysql_grant.grafana_on_call,
│ provider "provider[\"registry.terraform.io/petoju/mysql\"]" produced an
│ unexpected new value: Root object was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Steps to Reproduce

  1. terraform apply
petoju commented 2 months ago

The issue here looks like incorrect grant parsing. I can fix that only later; I guess this was broken in 3.0.44 (so 3.0.43 could work).

Which server & version did you use? I should probably add that to tests.

Dňa pi 19. 4. 2024, 13:43 Valentin FOUQUERON @.***> napísal(a):

Hi there,

please follow these steps to ensure quick resolution of your issue.

The maintainer (petoju) manages this project in a free time and thus doesn't have plenty of time to resolve all the issues. With that mentioned, PRs are always welcome. Provider version

3.0.55 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_database" "app" { default_character_set = "utf8mb4" default_collation = "utf8mb4_unicode_ci" name = "grafana-on-call" } resource "mysql_user" "grafana_on_call" { user = "grafana-on-call" host = var.nodes_url plaintext_password = random_password.mysql.result tls_option = "SSL" } resource "mysql_grant" "grafana_on_call" { user = mysql_user.grafana_on_call.user host = mysql_user.grafana_on_call.host database = mysql_database.app.name privileges = [ "DELETE", "INSERT", "SELECT", "UPDATE" ] }

Debug Output Expected Behavior

The created user get his grant created with success Actual Behavior

Terraform output this error:

| Error: Provider produced inconsistent result after apply │ │ When applying changes to │ module.applications.module.grafana-on-call.mysql_grant.grafana_on_call, │ provider "provider[\"registry.terraform.io/petoju/mysql\ http://registry.terraform.io/petoju/mysql%5C"]" produced an │ unexpected new value: Root object was present, but now absent. │ │ This is a bug in the provider, which should be reported in the provider's │ own issue tracker.

Steps to Reproduce

  1. terraform apply

— Reply to this email directly, view it on GitHub https://github.com/petoju/terraform-provider-mysql/issues/137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXINWCAA3CRCXPFPOIJUYLY6D7M3AVCNFSM6AAAAABGPAVVWCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TENZXGIYDEOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

vfouqueron commented 2 months ago

Thank you for your quick feedback. I'm using a MySQL 8 server

It works with 3.0.43 :) I'll stick with this version until you're able to fix it

dgonzalezp commented 2 months ago

Happening to me as well, thanks for updating @petoju. I tried version 3.0.43 and version 3.0.40 and the issue is still there.

image

Configuration files are similar to the ones provided, apply to an Azure MySQL flexible server ver 8.0

Update: Worked for me with version 3.0.20 way long back.

Update: So in my case, i'm getting the error since version 3.0.23. The last working one for me is 3.0.22. You may want to check there. Thank you again.

petoju commented 2 months ago

@dgonzalezp could you please send at least part of the log? Our description on getting the logs is in our issue template: https://github.com/petoju/terraform-provider-mysql/blob/master/.github/ISSUE_TEMPLATE.md

I believe your issue is completely different from the originally reported one.

petoju commented 2 months ago

@vfouqueron this should be fixed in provider 3.0.56

dgonzalezp commented 2 months ago

Issue was fixed for me too, can confirm it works with version 3.0.57, thanks @petoju for your great work