Open tperryba opened 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.
@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.
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.
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:
magento-dev-biq-77777-j2bhc
. TOguiding_jackal
@%
, parsed grant is mysql.TablePrivilegeGrant: &{magento-dev-biq-77777-j2bhc [ALL PRIVILEGES] false {guiding_jackal %} NONE}: timestamp=2024-04-09T10:51:31.552-0400 2024-04-09T10:51:31.552-0400 [INFO] provider.terraform-provider-mysql_v3.0.54: 2024/04/09 10:51:31 [DEBUG] Parsed grants are: [%!s(mysql.TablePrivilegeGrant=&{magento-dev-biq-77777-j2bhc [ALL PRIVILEGES] false {guiding_jackal %} NONE})]: timestamp=2024-04-09T10:51:31.552-0400 2024-04-09T10:51:31.552-0400 [INFO] provider.terraform-provider-mysql_v3.0.54: 2024/04/09 10:51:31 Executing statement: GRANT ALL PRIVILEGES ONmagento-dev-BIQ-77777-j2bhc
. TO 'guiding_jackal'@'%': timestamp=2024-04-09T10:51:31.552-0400 2024-04-09T10:51:31.748-0400 [INFO] provider.terraform-provider-mysql_v3.0.54: 2024/04/09 10:51:31 [DEBUG] Using dsn: fast_lionfish:gNHIf>NBOSGH7b_ty!YknxL?z4uhxwmh@tcp(dev-biq-77777-mysql-server.xxxxx.mysql.database.azure.com)/?checkConnLiveness=false&interpolateParams=true&tls=false&maxAllowedPacket=0: timestamp=2024-04-09T10:51:31.748-0400 2024-04-09T10:51:31.748-0400 [INFO] provider.terraform-provider-mysql_v3.0.54: 2024/04/09 10:51:31 [DEBUG] SQL: SHOW GRANTS FOR 'guiding_jackal'@'%': timestamp=2024-04-09T10:51:31.748-0400 2024-04-09T10:51:31.933-0400 [INFO] provider.terraform-provider-mysql_v3.0.54: 2024/04/09 10:51:31 [DEBUG] Got: GRANT ALL PRIVILEGES ONmagento-dev-biq-77777-j2bhc
. TOguiding_jackal
@%
, parsed grant is mysql.TablePrivilegeGrant: &{magento-dev-biq-77777-j2bhc [ALL PRIVILEGES] false {guiding_jackal %} NONE}: timestamp=2024-04-09T10:51:31.933-0400 2024-04-09T10:51:31.933-0400 [INFO] provider.terraform-provider-mysql_v3.0.54: 2024/04/09 10:51:31 [DEBUG] Parsed grants are: [%!s(mysql.TablePrivilegeGrant=&{magento-dev-biq-77777-j2bhc [ALL PRIVILEGES] false {guiding_jackal %} NONE})]: timestamp=2024-04-09T10:51:31.933-0400 2024-04-09T10:51:31.933-0400 [INFO] provider.terraform-provider-mysql_v3.0.54: 2024/04/09 10:51:31 [WARN] GRANT not found for {guiding_jackal %} - removing from state: timestamp=2024-04-09T10:51:31.933-0400 2024-04-09T10:51:31.933-0400 [DEBUG] State storage *remote.State declined to persist a state snapshot 2024-04-09T10:51:31.933-0400 [ERROR] vertex "mysql_grant.magento_grant" error: Provider produced inconsistent result after apply 2024-04-09T10:51:31.934-0400 [DEBUG] states/remote: state read serial is: 72; serial is: 72 2024-04-09T10:51:31.934-0400 [DEBUG] states/remote: state read lineage is: aaf31d0f-02a4-e728-19fa-43abaebc58cf; lineage is: aaf31d0f-02a4-e728-19fa-43abaebc58cf 2024-04-09T10:51:31.935-0400 [DEBUG] Azure Backend Request: HEAD /magento-terraform/magento-terraform.tfstateenv%3Adev-BIQ-77777 HTTP/1.1 Host: batfstate.blob.core.windows.net User-Agent: HashiCorp Terraform/1.7.5 (+https://www.terraform.io) X-Ms-Date: Tue, 09 Apr 2024 14:51:31 GMT X-Ms-Lease-Id: 2c4eaddb-9c99-76e7-353d-dd3d6be6b6a9 X-Ms-Version: 2018-11-09 2024-04-09T10:51:32.012-0400 [DEBUG] Azure Backend Response for https://batfstate.blob.core.windows.net/magento-terraform/magento-terraform.tfstateenv%3Adev-BIQ-77777: HTTP/1.1 200 OK Content-Length: 37070Expected 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:
terraform apply
Important Factoids
This is running in Azure against a Azure Flexible Mysql Server