» alicloud_ess_scalinggroup_vserver_groups

Attaches/Detaches vserver groups to a specified scaling group.

» Example Usage

variable "name" {
  default = "testAccEssVserverGroupsAttachment"
}

data "alicloud_zones" "default" {
  available_disk_category     = "cloud_efficiency"
  available_resource_creation = "VSwitch"
}

resource "alicloud_vpc" "default" {
  name       = "${var.name}"
  cidr_block = "172.16.0.0/16"
}

resource "alicloud_vswitch" "default" {
  vpc_id            = "${alicloud_vpc.default.id}"
  cidr_block        = "172.16.0.0/24"
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"
  name              = "${var.name}"
}

resource "alicloud_slb" "default" {
  name = "${var.name}"
  vswitch_id = "${alicloud_vswitch.default.id}"
}

resource "alicloud_slb_server_group" "default" {
  load_balancer_id = "${alicloud_slb.default.id}"
  name = "test"
}

resource "alicloud_slb_listener" "default" {
  count = 2
  load_balancer_id = "${element(alicloud_slb.default.*.id, count.index)}"
  backend_port = "22"
  frontend_port = "22"
  protocol = "tcp"
  bandwidth = "10"
  health_check_type = "tcp"
}

resource "alicloud_ess_scaling_group" "default" {
  min_size = "2"
  max_size = "2"
  scaling_group_name = "${var.name}"
  vswitch_ids = ["${alicloud_vswitch.default.id}"]
  depends_on = ["alicloud_slb_listener.default"]
}

resource "alicloud_ess_scalinggroup_vserver_groups" "default" {
  scaling_group_id = "${alicloud_ess_scaling_group.default.id}"
  vserver_groups {
  loadbalancer_id = "${alicloud_slb.default.id}"
  vserver_attributes {
    vserver_group_id = "${alicloud_slb_server_group.default.id}"
    port = "100"
    weight = "60"
    }
  }
}

» Argument Reference

The following arguments are supported:

» Block vserver_group

the vserver_group supports the following:

  • loadbalancer_id - (Required) Loadbalancer server ID of VServer Group.
  • vserver_attributes - (Required) A list of VServer Group attributes. See Block vserver_attribute below for details.
  • force - (Optional, Available in 1.64.0+) If instances of scaling group are attached/removed from slb backend server when attach/detach vserver group from scaling group. Default to true.

» Block vserver_attribute

  • vserver_group_id - (Required) ID of VServer Group.
  • port - (Required) - The port will be used for VServer Group backend server.
  • weight - (Required) The weight of an ECS instance attached to the VServer Group.

» Attributes Reference

The following attributes are exported:

  • id - (Required, ForceNew) The ESS vserver groups attachment resource ID.

» Import

ESS vserver groups can be imported using the id, e.g.

$ terraform import alicloud_ess_vserver_groups.example abc123456