aliyun / terraform-provider-alicloud

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

Load Balancer / Scaling Group association fails on first run vol.2 #1628

Open GabrielZabielski opened 5 years ago

GabrielZabielski commented 5 years ago

Hi there,

I'm according to similar issue: Load Balancer / Scaling Group association fails on first run vol.1

Terraform Version

Terraform v0.12.7

Terraform Configuration Files

variable "region" {}
provider "alicloud" {
  region = var.region
}

data "alicloud_images" "any" {
  name_regex  = "centos"
  most_recent = true
}

data "alicloud_zones" "zones_ds" {
  available_instance_type = "ecs.t5-lc2m1.nano"
  available_disk_category = "cloud_ssd"
}

resource "alicloud_vpc" "vpc" {
  name       = "vpc"
  cidr_block = "10.0.0.0/16"
}

resource "alicloud_vswitch" "vswitch-1" {
  name              = "vswitch-1"
  vpc_id            = alicloud_vpc.vpc.id
  cidr_block        = "10.0.0.0/18"
  availability_zone = data.alicloud_zones.zones_ds.zones[0].id
}

resource "alicloud_security_group" "sg" {
  vpc_id = alicloud_vpc.vpc.id
}

resource "alicloud_ess_scaling_configuration" "conf" {
  image_id         = data.alicloud_images.any.ids[0]
  scaling_group_id = alicloud_ess_scaling_group.ess-scaling-group.id
  instance_type    = "ecs.t5-lc2m1.nano"
  force_delete     = true
  security_group_id = alicloud_security_group.sg.id
}

resource "alicloud_ess_scaling_group" "ess-scaling-group" {
  min_size           = 2
  max_size           = 2
  scaling_group_name = "example"
  vswitch_ids        = [alicloud_vswitch.vswitch-1.id]
  loadbalancer_ids   = [alicloud_slb.slb.id]
  multi_az_policy    = "BALANCE"
}

resource "alicloud_slb" "slb" {
  name       = "terraform-slb"
  internet   = false
  bandwidth  = 2
  vswitch_id = alicloud_vswitch.vswitch-1.id
}

resource "alicloud_slb_listener" "tcp_http" {
  load_balancer_id  = alicloud_slb.slb.id
  backend_port      = "22"
  frontend_port     = "22"
  bandwidth         = 10
  protocol          = "http"
  health_check_type = "tcp"
}

resource "alicloud_eip" "eip" {
  name                 = "eip"
  internet_charge_type = "PayByTraffic"
}

resource "alicloud_eip_association" "eip_load_balancer_association" {
  allocation_id = alicloud_eip.eip.id
  instance_id   = alicloud_slb.slb.id
}

Expected Behavior

  1. Apply once...
  2. Feedback about a fixed issue a few days after release.
    • I'm according to previews issue - Response 20 days after release? realy? And there are only more errors than was... (look at Important Factoids)

Actual Behavior

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:138: Resource alicloud_ess_scalinggroup CreateScalingGroup Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
SDK.ServerError
ErrorCode: IncorrectLoadBalancerStatus
Recommend: 
RequestId: CE8443A4-4245-4357-A1D9-3EDB5B2B7976
Message: The current status of the load balancer "lb-xxxxxxxx" does not support this action.

  on main.tf line 39, in resource "alicloud_ess_scaling_group" "ess-scaling-group":
  39: resource "alicloud_ess_scaling_group" "ess-scaling-group" {

Steps to Reproduce

  1. terraform init && terraform apply

Important Factoids

Infrastructure with is created using main terraform modules, that creating same infrastructure returns another error:

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:138: Resource alicloud_ess_scalinggroup CreateScalingGroup Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
SDK.ServerError
ErrorCode: IncorrectLoadBalancerHealthCheck
Recommend: 
RequestId: E5E2B5EB-3EA7-4C90-8C24-A9D3D29E054F
Message: The current health check type of load balancer "lb-xxxxxxxxxxxxxxxxxxxx" does not support this action.

References

preview issue

liuxu6 commented 5 years ago

resource "alicloud_ess_scaling_group" "ess-scaling-group" { depends_on = [alicloud_slb_listener.tcp_http] // you can add there "depends_on" . min_size = 2 max_size = 2 scaling_group_name = "example" vswitch_ids = [alicloud_vswitch.vswitch-1.id] loadbalancer_ids = [alicloud_slb.slb.id] multi_az_policy = "BALANCE" }

GabrielZabielski commented 5 years ago

Sorry for late. Ok, so if we can't do it the standard way I need to rewrite few modules and attach to them depends_on. Anyway, thanks :)

AllanYin commented 5 years ago

Even with depends_on, I am still experiencing the intermittent issue of this. Provider: 1.58

GabrielZabielski commented 5 years ago

Even with depends_on, I am still experiencing the intermittent issue of this. Provider: 1.58

Could you desribe?


Hello guys, I have probably related issue with every terraform provider version since 1.55.4.

Error:

module.haproxy.module.ess.alicloud_ess_scaling_group.scaling_group[0]: Creating...

module.iis_cluster_beijing.module.ess_iis.alicloud_ess_scaling_group.scaling_group[0]: Creating...

module.iis_cluster_shanghai.module.ess_iis.alicloud_ess_scaling_group.scaling_group[0]: Creating...

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:117:

[ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:345:

[ERROR] terraform-provider-alicloud/alicloud/service_alicloud_slb.go:270:

[ERROR] terraform-provider-alicloud/alicloud/service_alicloud_slb.go:54: ResourceNotfound!!! [SDK alibaba-cloud-sdk-go ERROR]:

The specified Slb lb-gs5pjk7mw3xp3fo7oe5w8 is not found.

  on .terraform/modules/haproxy.ess/terraform/Alicloud/compute/ess/main.tf line 2, in resource "alicloud_ess_scaling_group" "scaling_group":

   2: resource "alicloud_ess_scaling_group" "scaling_group" {

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:117:

[ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:345:

[ERROR] terraform-provider-alicloud/alicloud/service_alicloud_slb.go:270:

[ERROR] terraform-provider-alicloud/alicloud/service_alicloud_slb.go:54: ResourceNotfound!!! [SDK alibaba-cloud-sdk-go ERROR]:

The specified Slb lb-dj19k5q8eyh6vbvpdgoj5 is not found.

  on .terraform/modules/iis_cluster_beijing.ess_iis/terraform/Alicloud/compute/ess/main.tf line 2, in resource "alicloud_ess_scaling_group" "scaling_group":

   2: resource "alicloud_ess_scaling_group" "scaling_group" {

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:117:

[ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_ess_scalinggroup.go:345:

[ERROR] terraform-provider-alicloud/alicloud/service_alicloud_slb.go:270:

[ERROR] terraform-provider-alicloud/alicloud/service_alicloud_slb.go:54: ResourceNotfound!!! [SDK alibaba-cloud-sdk-go ERROR]:

The specified Slb lb-6nn1lpvsj82cu0fohxgv1 is not found

  on .terraform/modules/iis_cluster_shanghai.ess_iis/terraform/Alicloud/compute/ess/main.tf line 2, in resource "alicloud_ess_scaling_group" "scaling_group":

   2: resource "alicloud_ess_scaling_group" "scaling_group" {
xiaozhu36 commented 4 years ago

HI @GabrielZabielski It seems like you used a incorrect region. Can you check it?