LifecycleHookArgs

data class LifecycleHookArgs(val defaultResult: Output<String>? = null, val heartbeatTimeout: Output<Int>? = null, val lifecycleTransition: Output<String>? = null, val name: Output<String>? = null, val notificationArn: Output<String>? = null, val notificationMetadata: Output<String>? = null, val scalingGroupId: Output<String>? = null) : ConvertibleToJava<LifecycleHookArgs>

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

NOTE: Available since v1.13.0.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.ess.ScalingGroup;
import com.pulumi.alicloud.ess.ScalingGroupArgs;
import com.pulumi.alicloud.ess.LifecycleHook;
import com.pulumi.alicloud.ess.LifecycleHookArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableDiskCategory("cloud_efficiency")
.availableResourceCreation("VSwitch")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.16.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vswitchName(name)
.build());
var default2 = new Switch("default2", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.1.0/24")
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vswitchName(String.format("%s-bar", name))
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.vpcId(defaultNetwork.id())
.build());
var defaultScalingGroup = new ScalingGroup("defaultScalingGroup", ScalingGroupArgs.builder()
.minSize("1")
.maxSize("1")
.scalingGroupName(name)
.defaultCooldown(200)
.removalPolicies(
"OldestInstance",
"NewestInstance")
.vswitchIds(
defaultSwitch.id(),
default2.id())
.build());
var defaultLifecycleHook = new LifecycleHook("defaultLifecycleHook", LifecycleHookArgs.builder()
.scalingGroupId(defaultScalingGroup.id())
.lifecycleTransition("SCALE_OUT")
.heartbeatTimeout(400)
.notificationMetadata("example")
.build());
}
}

Module Support

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

Import

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

$ pulumi import alicloud:ess/lifecycleHook:LifecycleHook example ash-l12345

Constructors

Link copied to clipboard
fun LifecycleHookArgs(defaultResult: Output<String>? = null, heartbeatTimeout: Output<Int>? = null, lifecycleTransition: Output<String>? = null, name: Output<String>? = null, notificationArn: Output<String>? = null, notificationMetadata: Output<String>? = null, scalingGroupId: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): LifecycleHookArgs

Properties

Link copied to clipboard
val defaultResult: Output<String>? = null

Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses. Applicable value: CONTINUE, ABANDON, ROLLBACK, default value: CONTINUE.

Link copied to clipboard
val heartbeatTimeout: Output<Int>? = null

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.

Link copied to clipboard
val lifecycleTransition: Output<String>? = null

Type of Scaling activity attached to lifecycle hook. Supported value: SCALE_OUT, SCALE_IN.

Link copied to clipboard
val name: Output<String>? = null

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.

Link copied to clipboard
val notificationArn: Output<String>? = null

The Arn of notification target.

Link copied to clipboard
val notificationMetadata: Output<String>? = null

Additional information that you want to include when Auto Scaling sends a message to the notification target.

Link copied to clipboard
val scalingGroupId: Output<String>? = null

The ID of the Auto Scaling group to which you want to assign the lifecycle hook.