alicloud_ess_suspend_process

更新时间:

Suspend/Resume processes to a specified scaling group.

For information about scaling group suspend process, see SuspendProcesses.

-> NOTE: Available since v1.166.0.

Example Usage


variable "name" {
  default = "terraform-example"
}

resource "random_integer" "default" {
  min = 10000
  max = 99999
}

locals {
  name = "${var.name}-${random_integer.default.result}"
}

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

data "alicloud_instance_types" "default" {
  availability_zone = data.alicloud_zones.default.zones[0].id
  cpu_core_count    = 2
  memory_size       = 4
}

data "alicloud_images" "default" {
  name_regex  = "^ubuntu_18.*64"
  most_recent = true
  owners      = "system"
}

resource "alicloud_vpc" "default" {
  vpc_name   = local.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"
  zone_id      = data.alicloud_zones.default.zones[0].id
  vswitch_name = local.name
}

resource "alicloud_security_group" "default" {
  name   = local.name
  vpc_id = alicloud_vpc.default.id
}

resource "alicloud_ess_scaling_group" "default" {
  min_size           = 1
  max_size           = 1
  scaling_group_name = local.name
  vswitch_ids        = [alicloud_vswitch.default.id]
  removal_policies   = ["OldestInstance"]
  default_cooldown   = 200
}

resource "alicloud_ess_scaling_configuration" "default" {
  scaling_group_id  = alicloud_ess_scaling_group.default.id
  image_id          = data.alicloud_images.default.images[0].id
  instance_type     = data.alicloud_instance_types.default.instance_types[0].id
  security_group_id = alicloud_security_group.default.id
  force_delete      = true
  active            = true
  enable            = true
}

resource "alicloud_ess_suspend_process" "default" {
  scaling_group_id = alicloud_ess_scaling_configuration.default.scaling_group_id
  process          = "ScaleIn"
}

Argument Reference

The following arguments are supported:

  • scaling_group_id - (Required, ForceNew) ID of the scaling group.
  • process - (Required, ForceNew) Activity type N that you want to suspend. Valid values are: SCALE_OUT,SCALE_IN,HealthCheck,AlarmNotification and ScheduledAction.

Attributes Reference

The following attributes are exported:

  • id - (Required, ForceNew) The ESS suspend process resource ID,in the follwing format: scaling_group_id:process.

Import

ESS suspend process can be imported using the id, e.g.

$ terraform import alicloud_suspend_process.example asg-xxx:sgp-xxx:5000 

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 1 mins) Used when create the process.
  • delete - (Defaults to 1 mins) Used when delete the process.