【问题标题】:Not able to create mysql user with AWSAuthenticationPlugin with terraform无法使用 AWSAuthenticationPlugin 和 terraform 创建 mysql 用户
【发布时间】:2019-12-16 04:17:57
【问题描述】:

我正在尝试为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.

我正在阅读文档并尝试调试出了什么问题,但找不到任何东西。

谁能帮我解决这个问题?

【问题讨论】:

  • 您使用的是哪个版本的mysql 提供程序?
  • 我正在使用 mysql_v1.5.0

标签: mysql terraform amazon-iam rds terraform-provider-aws


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2021-04-01
    • 1970-01-01
    • 2022-07-26
    • 1970-01-01
    • 2017-08-16
    • 2021-01-21
    • 2019-10-12
    • 2020-08-27
    • 1970-01-01
    相关资源
    最近更新 更多