无法使用带有 terraform 的 AWSAuthenticationPlugin 创建 mysql 用户

Not able to create mysql user with AWSAuthenticationPlugin with terraform

我正在尝试为 use with IAM 创建一个 MySQL 用户,我正在使用 terraform 来执行此操作。

这就是我想要完成的事情:

CREATE USER 'lambda' IDENTIFIED WITH AWSAuthenticationPlugin as 'RDS';

provider "mysql" {
  alias    = "kadamb-test"
  endpoint = "${aws_db_instance.kadamb-test.endpoint}"
  username = "${aws_db_instance.kadamb-test.username}"
  password = "${aws_db_instance.kadamb-test.password}"
}


resource "mysql_user" "kadamb-test-iam-user" {
  provider = "mysql.kadamb-test"
  user = "kadamb_test_user"
  host = "%"
  auth_plugin = "AWSAuthenticationPlugin"
  tls_option = ""
}

这是我 运行 terraform-apply:

时的输出
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + mysql_user.kadamb-test-iam-user
      id:          <computed>
      auth_plugin: "AWSAuthenticationPlugin"
      host:        "%"
      user:        "kadamb_test_user"


Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

mysql_user.kadamb-test-iam-user: Creating...
  auth_plugin: "" => "AWSAuthenticationPlugin"
  host:        "" => "%"
  user:        "" => "kadamb_test_user"

Error: Error applying plan:

1 error(s) occurred:

* mysql_user.kadamb-test-iam-user: 1 error(s) occurred:

* mysql_user.kadamb-test-iam-user: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

我正在阅读文档并尝试调试出错的地方,但找不到任何东西。

谁能帮我解决这个问题?

只需将 tls_option = "" 更改为 tls_option = "NONE",解决了我的问题。
我不确定它有什么不同,有什么不同,但我可以用它来创建用户。