aliyun / terraform-provider-alicloud

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

[Bug] Cannot create multi_zone RDS instance due to SDK error #2271

Open andyzhang495 opened 4 years ago

andyzhang495 commented 4 years ago

Terraform Version

Terraform v0.12.18

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

terraform {
  required_providers {
    alicloud = "v1.72.0"
  }
}

variable "alicloud_access_key" {}
variable "alicloud_secret_key" {}

provider "alicloud" {
  access_key = var.alicloud_access_key
  secret_key = var.alicloud_secret_key
  region     = "cn-shanghai"
}

resource "alicloud_db_instance" "postgresql" {
  instance_storage         = 20
  db_instance_storage_type = "cloud_ssd"

  engine           = "PostgreSQL"
  engine_version   = "10.0"
  instance_type    = "pg.n2.medium.2c"
  instance_name    = "tf-test"
  zone_id          = "cn-shanghai-MAZ4(e,f)"
  vswitch_id       = "vsw-xxxxxxxxxxxx"

  security_ips     = ["10.0.0.0/8"]
}

Debug Output

Console output of terraform apply

alicloud_db_instance.postgresql: Creating...

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_db_instance.go:224: Resource  CreateDBInstance Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
SDK.ServerError
ErrorCode: AtLeastTwoVSwitchParamExists
Recommend:
RequestId: 80FE08D3-7E0C-4CEF-9B8F-7B1862CBE8A5
Message: The specified params(Vswitchs) at least two.

  on main.tf line 21, in resource "alicloud_db_instance" "postgresql":
  21: resource "alicloud_db_instance" "postgresql" {

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

The database should be created and apply should be succeeded.

Actual Behavior

terraform apply reported error when calling AliCloud API using alibaba-cloud-sdk-go

Steps to Reproduce

  1. terraform apply

Important Factoids

Use multi zone id such as cn-shanghai-MAZ4(e,f)

References

caryyu commented 4 years ago

Hi @xiaozhu36, I think the issue is at https://github.com/terraform-providers/terraform-provider-alicloud/blob/v1.72.0/alicloud/resource_alicloud_db_instance.go#L692, I suppose vpcService.DescribeVSwitch method accepts only one switch id ?

caryyu commented 4 years ago

Hi @ringtail Please take a look at this bug

caryyu commented 4 years ago

@xiaozhu36 Hi, There's an update from today's test, We found out RDS of MySQL multi-zones works well, but RDS of PostgreSQL

jayendrapatil commented 4 years ago

Any update on this, we are facing the same issue and cannot use it production

zql-tqy commented 4 years ago

This bug has been fixed, please pull the new master code. If there are multiple vswitches, separate them with commas.

jayendrapatil commented 4 years ago

Which version of terraform alicloud provider is the fix available ?

yannrouillard commented 4 years ago

@Jayendra it is fixed in the v1.87.0 release AFAIK.