» alicloud_ess_lifecycle_hook

Provides a ESS lifecycle hook resource. More about Ess lifecycle hook, see LifecycleHook.

» Example Usage

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

resource "alicloud_vpc" "foo" {
  name       = "testAccEssScalingGroup_vpc"
  cidr_block = ""

resource "alicloud_vswitch" "foo" {
  vpc_id            = "${alicloud_vpc.foo.id}"
  cidr_block        = ""
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"

resource "alicloud_vswitch" "bar" {
  vpc_id            = "${alicloud_vpc.foo.id}"
  cidr_block        = ""
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"

resource "alicloud_ess_scaling_group" "foo" {
  min_size           = 1
  max_size           = 1
  scaling_group_name = "testAccEssScaling_group"
  removal_policies   = ["OldestInstance", "NewestInstance"]
  vswitch_ids        = ["${alicloud_vswitch.foo.id}", "${alicloud_vswitch.bar.id}"]

resource "alicloud_ess_lifecycle_hook" "foo" {
  scaling_group_id      = "${alicloud_ess_scaling_group.foo.id}"
  name                  = "testAccEssLifecycle_hook"
  lifecycle_transition  = "SCALE_OUT"
  heartbeat_timeout     = 400
  notification_metadata = "helloworld"

» Module Support

You can use to the existing autoscaling module to create a lifecycle hook, scaling group and configuration one-click.

» Argument Reference

The following arguments are supported:

  • scaling_group_id - (Required, ForceNew) The ID of the Auto Scaling group to which you want to assign the lifecycle hook.
  • name - (Optional, ForceNew) The name of the lifecycle hook, which must contain 2-64 characters (English or Chinese), starting with numbers, English letters or Chinese characters, and can contain number, underscores _, hypens -, and decimal point .. If this parameter value is not specified, the default value is lifecycle hook id.
  • lifecycle_transition - (Required) Type of Scaling activity attached to lifecycle hook. Supported value: SCALE_OUT, SCALE_IN.
  • heartbeat_timeout - (Optional) Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the default_result parameter. Default value: 600.
  • default_result - (Optional) Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses. Applicable value: CONTINUE, ABANDON, default value: CONTINUE.
  • notification_arn - (Optional) The Arn of notification target.
  • notification_metadata - (Optional) Additional information that you want to include when Auto Scaling sends a message to the notification target.

» Attribute Reference

The following attributes are exported:

» Import

Ess lifecycle hook can be imported using the id, e.g.

$ terraform import alicloud_ess_lifecycle_hook.example ash-l12345