-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
When I'm granting privilege to RDS account, I got 400 error
Example code:
resource "alicloud_db_database" "this" {
count = var.create_database ? length(var.databases) : 0
instance_id = alicloud_db_instance.example.id
name = lookup(var.databases[count.index], "name")
character_set = lookup(var.databases[count.index], "character_set")
description = lookup(var.databases[count.index], "description")
}
resource "alicloud_rds_account" "example" {
# count = var.create_app_account ? 1 : 0
db_instance_id = alicloud_db_instance.example.id
account_name = "qrcode_datasync"
account_password = var.qrcode_datasync_password
lifecycle {
ignore_changes = [
# Ignore changes to password, as this is manage via KMS in Alibaba
account_password
]
}
}
resource "alicloud_db_account_privilege" "example" {
count = var.create_app_account && var.create_database && length(var.databases) > 0 ? 1 : 0
instance_id = alicloud_db_instance.example.id
account_name = alicloud_rds_account.example.account_name
db_names = alicloud_db_database.this.*.name
privilege = "ReadWrite"
}
Error messages:
Terraform will perform the following actions:
# module.rds.alicloud_db_account_privilege.example[0] will be updated in-place
~ resource "alicloud_db_account_privilege" "example" {
~ db_names = [
+ "dev-xxxx-db",
]
id = "pgm-xxxxxxxx:qrcode_datasync:ReadWrite"
# (3 unchanged attributes hidden)
}
Plan: 0 to add, 1 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
module.rds.alicloud_db_account_privilege.example[0]: Modifying... [id=pgm-xxxxxx:qrcode_datasync:ReadWrite]
╷
│ Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_db_account_privilege.go:213:
│ [ERROR] terraform-provider-alicloud/alicloud/service_alicloud_rds.go:762: Resource pgm-xxxxxx:qrcode_datasync:ReadWrite GrantAccountPrivilege Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
│ SDKError:
│ StatusCode: 400
│ Code: InvalidDBInfo.Malformed
│ Message: code: 400, The specified parameter DBInfo is not valid or db not exist. request id: 5DC9ABED-D4A0-56F2-B797-5B2EC93C3AE9
│ Data: {"Code":"InvalidDBInfo.Malformed","HostId":"rds.aliyuncs.com","Message":"The specified parameter DBInfo is not valid or db not exist.","Recommend":"https://api.aliyun.com/troubleshoot?q=InvalidDBInfo.Malformed\u0026product=Rds\u0026requestId=5DC9ABED-D4A0-56F2-B797-5B2EC93C3AE9","RequestId":"5DC9ABED-D4A0-56F2-B797-5B2EC93C3AE9"}
│
│
│ with module.rds.alicloud_db_account_privilege.example[0],
│ on ../modules/rds_bak/main.tf line 71, in resource "alicloud_db_account_privilege" "example":
│ 71: resource "alicloud_db_account_privilege" "example" {
│
╵
Metadata
Metadata
Assignees
Labels
No labels