aliyun / terraform-provider-alicloud

Terraform AliCloud provider
https://www.terraform.io/docs/providers/alicloud/
Mozilla Public License 2.0
584 stars 548 forks source link

[Bug] Fail to create PolarDB database resource #3048

Open sinyiwsy opened 3 years ago

sinyiwsy commented 3 years ago

Terraform Version

Terraform v0.13.5
+ provider registry.terraform.io/aliyun/alicloud v1.103.0

Affected Resource(s)

Terraform Configuration Files

resource "alicloud_polardb_cluster" "cluster" {
    db_type       = "PostgreSQL"
    ...
}
# From the official example
resource "alicloud_polardb_database" "default" {
  db_cluster_id = alicloud_polardb_cluster.cluster.id
  db_name       = "tftestdatabase"
}

Expected Behavior

What should have happened? It should create a polar database in a PolarDB cluster.

Actual Behavior

What actually happened?

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_polardb_database.go:79: Resource  CreateDatabase Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
SDK.ServerError
ErrorCode: InvalidAccountName.Malformed
Recommend: https://error-center.aliyun.com/status/search?Keyword=InvalidAccountName.Malformed&source=PopGw
RequestId: **********
Message: The specified parameter "AccountName" is not valid.

  on test.tf line 24, in resource "alicloud_polardb_database" "default":
  24: resource "alicloud_polardb_database" "default" {

I have checked the documentation, and can't find any field/value related to AccountName.

Remark

In UI console, there is a required field "Database Owner", but the resource 'alicloud_polardb_database' doesn't have. I guess this error is caused by that.

xiaozhu36 commented 3 years ago

Hi @sinyiwsy I am sorry for late reply. This error shows the specified account name is incorrect and can you check it with docs: https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/polardb_account#account_name or share the account name with me?

sinyiwsy commented 3 years ago

Hi @sinyiwsy I am sorry for late reply. This error shows the specified account name is incorrect and can you check it with docs: https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/polardb_account#account_name or share the account name with me?

Hi @xiaozhu36 Thanks for your reply. I followed the example from official documentation, but it fails to build a database and show this error to me. And there is no option to select an user as a PolarDB database owner. Here is my terraforem script https://gist.github.com/sinyiwsy/4e72660d9820ae0db819967029ba6f23

I can create an account inside, but can't create a database.

xiaozhu36 commented 3 years ago

HI @sinyiwsy Can you share the RequestID with me? That can help me to locate the issue.

sinyiwsy commented 3 years ago

@xiaozhu36 No problem. I sent it to your email.