petoju / terraform-provider-mysql

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

Issue creating GRANT with `WITH GRANT OPTION` on MySQL 8.0 DB #1

Closed cten closed 2 years ago

cten commented 2 years ago

Terraform Version

1.0.1

Affected Resource(s)

Terraform Configuration Files

resource "mysql_grant" "vault_social_db_user_database" {
  user       = mysql_user.vault_social_db_user.user
  host       = mysql_user.vault_social_db_user.host
  database   = "%"
  table      = "*"
  privileges = ["ALL PRIVILEGES"]
  grant      = "true"
  provider   = mysql.social
}

Debug Output

mysql_grant.vault_social_db_user_database: Creating...
2021-12-08T12:42:47.022-0500 [TRACE] readResourceInstanceState: reading state for mysql_grant.vault_social_db_user_database
2021-12-08T12:42:47.022-0500 [TRACE] readResourceInstanceState: no state present for mysql_grant.vault_social_db_user_database
2021-12-08T12:42:47.022-0500 [TRACE] reducePlan: mysql_grant.vault_social_db_user_database change simplified from DeleteThenCreate to Create for apply node
2021-12-08T12:42:47.022-0500 [INFO]  Starting apply for mysql_grant.vault_social_db_user_database
2021-12-08T12:42:47.023-0500 [DEBUG] mysql_grant.vault_social_db_user_database: applying the planned Create change
2021-12-08T12:42:47.023-0500 [TRACE] GRPCProvider: ApplyResourceChange
2021-12-08T12:42:47.098-0500 [INFO]  provider.terraform-provider-mysql_v3.0.7: 2021/12/08 12:42:47 Executing statement: GRANT ALL PRIVILEGES ON `%`.* TO 'vault'@'%': timestamp=2021-12-08T12:42:47.098-0500
2021-12-08T12:42:47.198-0500 [WARN]  Provider "provider[\"registry.terraform.io/petoju/mysql\"].social" produced an unexpected new value for mysql_grant.vault_social_db_user_database, 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:
      - .grant: was cty.True, but now cty.False
2021-12-08T12:42:47.199-0500 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for mysql_grant.vault_social_db_user_database
2021-12-08T12:42:47.199-0500 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: writing state object for mysql_grant.vault_social_db_user_database
2021-12-08T12:42:47.199-0500 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for mysql_grant.vault_social_db_user_database
2021-12-08T12:42:47.199-0500 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: writing state object for mysql_grant.vault_social_db_user_database

Expected Behavior

GRANT OPTION applied/given to the user

Actual Behavior

GRANT OPTION is never applied to the user

Steps to Reproduce

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

  1. terraform apply
petoju commented 2 years ago

@cten tests were added and this has been fixed in v3.0.9.