1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. AsLifecycleHook
tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack

tencentcloud.AsLifecycleHook

Explore with Pulumi AI

Provides a resource for an AS (Auto scaling) lifecycle hook.

Example Usage

Create a basic LifecycleHook

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const zones = tencentcloud.getAvailabilityZonesByProduct({
    product: "as",
});
const image = tencentcloud.getImages({
    imageTypes: ["PUBLIC_IMAGE"],
    osName: "TencentOS Server 3.2 (Final)",
});
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
const subnet = new tencentcloud.Subnet("subnet", {
    vpcId: vpc.vpcId,
    cidrBlock: "10.0.0.0/16",
    availabilityZone: zones.then(zones => zones.zones?.[0]?.name),
});
const exampleAsScalingConfig = new tencentcloud.AsScalingConfig("exampleAsScalingConfig", {
    configurationName: "tf-example",
    imageId: image.then(image => image.images?.[0]?.imageId),
    instanceTypes: [
        "SA1.SMALL1",
        "SA2.SMALL1",
        "SA2.SMALL2",
        "SA2.SMALL4",
    ],
    instanceNameSettings: {
        instanceName: "test-ins-name",
    },
});
const exampleAsScalingGroup = new tencentcloud.AsScalingGroup("exampleAsScalingGroup", {
    scalingGroupName: "tf-example",
    configurationId: exampleAsScalingConfig.asScalingConfigId,
    maxSize: 1,
    minSize: 0,
    vpcId: vpc.vpcId,
    subnetIds: [subnet.subnetId],
});
const exampleAsLifecycleHook = new tencentcloud.AsLifecycleHook("exampleAsLifecycleHook", {
    scalingGroupId: exampleAsScalingGroup.asScalingGroupId,
    lifecycleHookName: "tf-as-lifecycle-hook",
    lifecycleTransition: "INSTANCE_LAUNCHING",
    defaultResult: "CONTINUE",
    heartbeatTimeout: 500,
    lifecycleTransitionType: "NORMAL",
    notificationMetadata: "tf test",
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

zones = tencentcloud.get_availability_zones_by_product(product="as")
image = tencentcloud.get_images(image_types=["PUBLIC_IMAGE"],
    os_name="TencentOS Server 3.2 (Final)")
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
subnet = tencentcloud.Subnet("subnet",
    vpc_id=vpc.vpc_id,
    cidr_block="10.0.0.0/16",
    availability_zone=zones.zones[0].name)
example_as_scaling_config = tencentcloud.AsScalingConfig("exampleAsScalingConfig",
    configuration_name="tf-example",
    image_id=image.images[0].image_id,
    instance_types=[
        "SA1.SMALL1",
        "SA2.SMALL1",
        "SA2.SMALL2",
        "SA2.SMALL4",
    ],
    instance_name_settings={
        "instance_name": "test-ins-name",
    })
example_as_scaling_group = tencentcloud.AsScalingGroup("exampleAsScalingGroup",
    scaling_group_name="tf-example",
    configuration_id=example_as_scaling_config.as_scaling_config_id,
    max_size=1,
    min_size=0,
    vpc_id=vpc.vpc_id,
    subnet_ids=[subnet.subnet_id])
example_as_lifecycle_hook = tencentcloud.AsLifecycleHook("exampleAsLifecycleHook",
    scaling_group_id=example_as_scaling_group.as_scaling_group_id,
    lifecycle_hook_name="tf-as-lifecycle-hook",
    lifecycle_transition="INSTANCE_LAUNCHING",
    default_result="CONTINUE",
    heartbeat_timeout=500,
    lifecycle_transition_type="NORMAL",
    notification_metadata="tf test")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		zones, err := tencentcloud.GetAvailabilityZonesByProduct(ctx, &tencentcloud.GetAvailabilityZonesByProductArgs{
			Product: "as",
		}, nil)
		if err != nil {
			return err
		}
		image, err := tencentcloud.GetImages(ctx, &tencentcloud.GetImagesArgs{
			ImageTypes: []string{
				"PUBLIC_IMAGE",
			},
			OsName: pulumi.StringRef("TencentOS Server 3.2 (Final)"),
		}, nil)
		if err != nil {
			return err
		}
		vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}
		subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
			VpcId:            vpc.VpcId,
			CidrBlock:        pulumi.String("10.0.0.0/16"),
			AvailabilityZone: pulumi.String(zones.Zones[0].Name),
		})
		if err != nil {
			return err
		}
		exampleAsScalingConfig, err := tencentcloud.NewAsScalingConfig(ctx, "exampleAsScalingConfig", &tencentcloud.AsScalingConfigArgs{
			ConfigurationName: pulumi.String("tf-example"),
			ImageId:           pulumi.String(image.Images[0].ImageId),
			InstanceTypes: pulumi.StringArray{
				pulumi.String("SA1.SMALL1"),
				pulumi.String("SA2.SMALL1"),
				pulumi.String("SA2.SMALL2"),
				pulumi.String("SA2.SMALL4"),
			},
			InstanceNameSettings: &tencentcloud.AsScalingConfigInstanceNameSettingsArgs{
				InstanceName: pulumi.String("test-ins-name"),
			},
		})
		if err != nil {
			return err
		}
		exampleAsScalingGroup, err := tencentcloud.NewAsScalingGroup(ctx, "exampleAsScalingGroup", &tencentcloud.AsScalingGroupArgs{
			ScalingGroupName: pulumi.String("tf-example"),
			ConfigurationId:  exampleAsScalingConfig.AsScalingConfigId,
			MaxSize:          pulumi.Float64(1),
			MinSize:          pulumi.Float64(0),
			VpcId:            vpc.VpcId,
			SubnetIds: pulumi.StringArray{
				subnet.SubnetId,
			},
		})
		if err != nil {
			return err
		}
		_, err = tencentcloud.NewAsLifecycleHook(ctx, "exampleAsLifecycleHook", &tencentcloud.AsLifecycleHookArgs{
			ScalingGroupId:          exampleAsScalingGroup.AsScalingGroupId,
			LifecycleHookName:       pulumi.String("tf-as-lifecycle-hook"),
			LifecycleTransition:     pulumi.String("INSTANCE_LAUNCHING"),
			DefaultResult:           pulumi.String("CONTINUE"),
			HeartbeatTimeout:        pulumi.Float64(500),
			LifecycleTransitionType: pulumi.String("NORMAL"),
			NotificationMetadata:    pulumi.String("tf test"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var zones = Tencentcloud.GetAvailabilityZonesByProduct.Invoke(new()
    {
        Product = "as",
    });

    var image = Tencentcloud.GetImages.Invoke(new()
    {
        ImageTypes = new[]
        {
            "PUBLIC_IMAGE",
        },
        OsName = "TencentOS Server 3.2 (Final)",
    });

    var vpc = new Tencentcloud.Vpc("vpc", new()
    {
        CidrBlock = "10.0.0.0/16",
    });

    var subnet = new Tencentcloud.Subnet("subnet", new()
    {
        VpcId = vpc.VpcId,
        CidrBlock = "10.0.0.0/16",
        AvailabilityZone = zones.Apply(getAvailabilityZonesByProductResult => getAvailabilityZonesByProductResult.Zones[0]?.Name),
    });

    var exampleAsScalingConfig = new Tencentcloud.AsScalingConfig("exampleAsScalingConfig", new()
    {
        ConfigurationName = "tf-example",
        ImageId = image.Apply(getImagesResult => getImagesResult.Images[0]?.ImageId),
        InstanceTypes = new[]
        {
            "SA1.SMALL1",
            "SA2.SMALL1",
            "SA2.SMALL2",
            "SA2.SMALL4",
        },
        InstanceNameSettings = new Tencentcloud.Inputs.AsScalingConfigInstanceNameSettingsArgs
        {
            InstanceName = "test-ins-name",
        },
    });

    var exampleAsScalingGroup = new Tencentcloud.AsScalingGroup("exampleAsScalingGroup", new()
    {
        ScalingGroupName = "tf-example",
        ConfigurationId = exampleAsScalingConfig.AsScalingConfigId,
        MaxSize = 1,
        MinSize = 0,
        VpcId = vpc.VpcId,
        SubnetIds = new[]
        {
            subnet.SubnetId,
        },
    });

    var exampleAsLifecycleHook = new Tencentcloud.AsLifecycleHook("exampleAsLifecycleHook", new()
    {
        ScalingGroupId = exampleAsScalingGroup.AsScalingGroupId,
        LifecycleHookName = "tf-as-lifecycle-hook",
        LifecycleTransition = "INSTANCE_LAUNCHING",
        DefaultResult = "CONTINUE",
        HeartbeatTimeout = 500,
        LifecycleTransitionType = "NORMAL",
        NotificationMetadata = "tf test",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.TencentcloudFunctions;
import com.pulumi.tencentcloud.inputs.GetAvailabilityZonesByProductArgs;
import com.pulumi.tencentcloud.inputs.GetImagesArgs;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.AsScalingConfig;
import com.pulumi.tencentcloud.AsScalingConfigArgs;
import com.pulumi.tencentcloud.inputs.AsScalingConfigInstanceNameSettingsArgs;
import com.pulumi.tencentcloud.AsScalingGroup;
import com.pulumi.tencentcloud.AsScalingGroupArgs;
import com.pulumi.tencentcloud.AsLifecycleHook;
import com.pulumi.tencentcloud.AsLifecycleHookArgs;
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 zones = TencentcloudFunctions.getAvailabilityZonesByProduct(GetAvailabilityZonesByProductArgs.builder()
            .product("as")
            .build());

        final var image = TencentcloudFunctions.getImages(GetImagesArgs.builder()
            .imageTypes("PUBLIC_IMAGE")
            .osName("TencentOS Server 3.2 (Final)")
            .build());

        var vpc = new Vpc("vpc", VpcArgs.builder()
            .cidrBlock("10.0.0.0/16")
            .build());

        var subnet = new Subnet("subnet", SubnetArgs.builder()
            .vpcId(vpc.vpcId())
            .cidrBlock("10.0.0.0/16")
            .availabilityZone(zones.applyValue(getAvailabilityZonesByProductResult -> getAvailabilityZonesByProductResult.zones()[0].name()))
            .build());

        var exampleAsScalingConfig = new AsScalingConfig("exampleAsScalingConfig", AsScalingConfigArgs.builder()
            .configurationName("tf-example")
            .imageId(image.applyValue(getImagesResult -> getImagesResult.images()[0].imageId()))
            .instanceTypes(            
                "SA1.SMALL1",
                "SA2.SMALL1",
                "SA2.SMALL2",
                "SA2.SMALL4")
            .instanceNameSettings(AsScalingConfigInstanceNameSettingsArgs.builder()
                .instanceName("test-ins-name")
                .build())
            .build());

        var exampleAsScalingGroup = new AsScalingGroup("exampleAsScalingGroup", AsScalingGroupArgs.builder()
            .scalingGroupName("tf-example")
            .configurationId(exampleAsScalingConfig.asScalingConfigId())
            .maxSize(1)
            .minSize(0)
            .vpcId(vpc.vpcId())
            .subnetIds(subnet.subnetId())
            .build());

        var exampleAsLifecycleHook = new AsLifecycleHook("exampleAsLifecycleHook", AsLifecycleHookArgs.builder()
            .scalingGroupId(exampleAsScalingGroup.asScalingGroupId())
            .lifecycleHookName("tf-as-lifecycle-hook")
            .lifecycleTransition("INSTANCE_LAUNCHING")
            .defaultResult("CONTINUE")
            .heartbeatTimeout(500)
            .lifecycleTransitionType("NORMAL")
            .notificationMetadata("tf test")
            .build());

    }
}
Copy
resources:
  vpc:
    type: tencentcloud:Vpc
    properties:
      cidrBlock: 10.0.0.0/16
  subnet:
    type: tencentcloud:Subnet
    properties:
      vpcId: ${vpc.vpcId}
      cidrBlock: 10.0.0.0/16
      availabilityZone: ${zones.zones[0].name}
  exampleAsScalingConfig:
    type: tencentcloud:AsScalingConfig
    properties:
      configurationName: tf-example
      imageId: ${image.images[0].imageId}
      instanceTypes:
        - SA1.SMALL1
        - SA2.SMALL1
        - SA2.SMALL2
        - SA2.SMALL4
      instanceNameSettings:
        instanceName: test-ins-name
  exampleAsScalingGroup:
    type: tencentcloud:AsScalingGroup
    properties:
      scalingGroupName: tf-example
      configurationId: ${exampleAsScalingConfig.asScalingConfigId}
      maxSize: 1
      minSize: 0
      vpcId: ${vpc.vpcId}
      subnetIds:
        - ${subnet.subnetId}
  exampleAsLifecycleHook:
    type: tencentcloud:AsLifecycleHook
    properties:
      scalingGroupId: ${exampleAsScalingGroup.asScalingGroupId}
      lifecycleHookName: tf-as-lifecycle-hook
      lifecycleTransition: INSTANCE_LAUNCHING
      defaultResult: CONTINUE
      heartbeatTimeout: 500
      lifecycleTransitionType: NORMAL
      #  lifecycle_transition_type = "EXTENSION"
      notificationMetadata: tf test
variables:
  zones:
    fn::invoke:
      function: tencentcloud:getAvailabilityZonesByProduct
      arguments:
        product: as
  image:
    fn::invoke:
      function: tencentcloud:getImages
      arguments:
        imageTypes:
          - PUBLIC_IMAGE
        osName: TencentOS Server 3.2 (Final)
Copy

If notification_target_type is CMQ_QUEUE

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const example = new tencentcloud.AsLifecycleHook("example", {
    scalingGroupId: tencentcloud_as_scaling_group.example.id,
    lifecycleHookName: "tf-as-lifecycle-hook",
    lifecycleTransition: "INSTANCE_LAUNCHING",
    defaultResult: "CONTINUE",
    heartbeatTimeout: 500,
    notificationMetadata: "tf test",
    notificationTargetType: "CMQ_QUEUE",
    notificationQueueName: "lifcyclehook",
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

example = tencentcloud.AsLifecycleHook("example",
    scaling_group_id=tencentcloud_as_scaling_group["example"]["id"],
    lifecycle_hook_name="tf-as-lifecycle-hook",
    lifecycle_transition="INSTANCE_LAUNCHING",
    default_result="CONTINUE",
    heartbeat_timeout=500,
    notification_metadata="tf test",
    notification_target_type="CMQ_QUEUE",
    notification_queue_name="lifcyclehook")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tencentcloud.NewAsLifecycleHook(ctx, "example", &tencentcloud.AsLifecycleHookArgs{
			ScalingGroupId:         pulumi.Any(tencentcloud_as_scaling_group.Example.Id),
			LifecycleHookName:      pulumi.String("tf-as-lifecycle-hook"),
			LifecycleTransition:    pulumi.String("INSTANCE_LAUNCHING"),
			DefaultResult:          pulumi.String("CONTINUE"),
			HeartbeatTimeout:       pulumi.Float64(500),
			NotificationMetadata:   pulumi.String("tf test"),
			NotificationTargetType: pulumi.String("CMQ_QUEUE"),
			NotificationQueueName:  pulumi.String("lifcyclehook"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var example = new Tencentcloud.AsLifecycleHook("example", new()
    {
        ScalingGroupId = tencentcloud_as_scaling_group.Example.Id,
        LifecycleHookName = "tf-as-lifecycle-hook",
        LifecycleTransition = "INSTANCE_LAUNCHING",
        DefaultResult = "CONTINUE",
        HeartbeatTimeout = 500,
        NotificationMetadata = "tf test",
        NotificationTargetType = "CMQ_QUEUE",
        NotificationQueueName = "lifcyclehook",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.AsLifecycleHook;
import com.pulumi.tencentcloud.AsLifecycleHookArgs;
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) {
        var example = new AsLifecycleHook("example", AsLifecycleHookArgs.builder()
            .scalingGroupId(tencentcloud_as_scaling_group.example().id())
            .lifecycleHookName("tf-as-lifecycle-hook")
            .lifecycleTransition("INSTANCE_LAUNCHING")
            .defaultResult("CONTINUE")
            .heartbeatTimeout(500)
            .notificationMetadata("tf test")
            .notificationTargetType("CMQ_QUEUE")
            .notificationQueueName("lifcyclehook")
            .build());

    }
}
Copy
resources:
  example:
    type: tencentcloud:AsLifecycleHook
    properties:
      scalingGroupId: ${tencentcloud_as_scaling_group.example.id}
      lifecycleHookName: tf-as-lifecycle-hook
      lifecycleTransition: INSTANCE_LAUNCHING
      defaultResult: CONTINUE
      heartbeatTimeout: 500
      notificationMetadata: tf test
      notificationTargetType: CMQ_QUEUE
      notificationQueueName: lifcyclehook
Copy

Or notification_target_type is CMQ_TOPIC

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const example = new tencentcloud.AsLifecycleHook("example", {
    scalingGroupId: tencentcloud_as_scaling_group.example.id,
    lifecycleHookName: "tf-as-lifecycle-hook",
    lifecycleTransition: "INSTANCE_LAUNCHING",
    defaultResult: "CONTINUE",
    heartbeatTimeout: 500,
    notificationMetadata: "tf test",
    notificationTargetType: "CMQ_TOPIC",
    notificationTopicName: "lifcyclehook",
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

example = tencentcloud.AsLifecycleHook("example",
    scaling_group_id=tencentcloud_as_scaling_group["example"]["id"],
    lifecycle_hook_name="tf-as-lifecycle-hook",
    lifecycle_transition="INSTANCE_LAUNCHING",
    default_result="CONTINUE",
    heartbeat_timeout=500,
    notification_metadata="tf test",
    notification_target_type="CMQ_TOPIC",
    notification_topic_name="lifcyclehook")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tencentcloud.NewAsLifecycleHook(ctx, "example", &tencentcloud.AsLifecycleHookArgs{
			ScalingGroupId:         pulumi.Any(tencentcloud_as_scaling_group.Example.Id),
			LifecycleHookName:      pulumi.String("tf-as-lifecycle-hook"),
			LifecycleTransition:    pulumi.String("INSTANCE_LAUNCHING"),
			DefaultResult:          pulumi.String("CONTINUE"),
			HeartbeatTimeout:       pulumi.Float64(500),
			NotificationMetadata:   pulumi.String("tf test"),
			NotificationTargetType: pulumi.String("CMQ_TOPIC"),
			NotificationTopicName:  pulumi.String("lifcyclehook"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var example = new Tencentcloud.AsLifecycleHook("example", new()
    {
        ScalingGroupId = tencentcloud_as_scaling_group.Example.Id,
        LifecycleHookName = "tf-as-lifecycle-hook",
        LifecycleTransition = "INSTANCE_LAUNCHING",
        DefaultResult = "CONTINUE",
        HeartbeatTimeout = 500,
        NotificationMetadata = "tf test",
        NotificationTargetType = "CMQ_TOPIC",
        NotificationTopicName = "lifcyclehook",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.AsLifecycleHook;
import com.pulumi.tencentcloud.AsLifecycleHookArgs;
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) {
        var example = new AsLifecycleHook("example", AsLifecycleHookArgs.builder()
            .scalingGroupId(tencentcloud_as_scaling_group.example().id())
            .lifecycleHookName("tf-as-lifecycle-hook")
            .lifecycleTransition("INSTANCE_LAUNCHING")
            .defaultResult("CONTINUE")
            .heartbeatTimeout(500)
            .notificationMetadata("tf test")
            .notificationTargetType("CMQ_TOPIC")
            .notificationTopicName("lifcyclehook")
            .build());

    }
}
Copy
resources:
  example:
    type: tencentcloud:AsLifecycleHook
    properties:
      scalingGroupId: ${tencentcloud_as_scaling_group.example.id}
      lifecycleHookName: tf-as-lifecycle-hook
      lifecycleTransition: INSTANCE_LAUNCHING
      defaultResult: CONTINUE
      heartbeatTimeout: 500
      notificationMetadata: tf test
      notificationTargetType: CMQ_TOPIC
      notificationTopicName: lifcyclehook
Copy

Use TAT Command

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const example = new tencentcloud.AsLifecycleHook("example", {
    defaultResult: "CONTINUE",
    heartbeatTimeout: 300,
    lifecycleHookName: "test",
    lifecycleTransition: "INSTANCE_TERMINATING",
    scalingGroupId: tencentcloud_as_scaling_group.example.id,
    lifecycleCommand: {
        commandId: "cmd-xxxx",
    },
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

example = tencentcloud.AsLifecycleHook("example",
    default_result="CONTINUE",
    heartbeat_timeout=300,
    lifecycle_hook_name="test",
    lifecycle_transition="INSTANCE_TERMINATING",
    scaling_group_id=tencentcloud_as_scaling_group["example"]["id"],
    lifecycle_command={
        "command_id": "cmd-xxxx",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tencentcloud.NewAsLifecycleHook(ctx, "example", &tencentcloud.AsLifecycleHookArgs{
			DefaultResult:       pulumi.String("CONTINUE"),
			HeartbeatTimeout:    pulumi.Float64(300),
			LifecycleHookName:   pulumi.String("test"),
			LifecycleTransition: pulumi.String("INSTANCE_TERMINATING"),
			ScalingGroupId:      pulumi.Any(tencentcloud_as_scaling_group.Example.Id),
			LifecycleCommand: &tencentcloud.AsLifecycleHookLifecycleCommandArgs{
				CommandId: pulumi.String("cmd-xxxx"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var example = new Tencentcloud.AsLifecycleHook("example", new()
    {
        DefaultResult = "CONTINUE",
        HeartbeatTimeout = 300,
        LifecycleHookName = "test",
        LifecycleTransition = "INSTANCE_TERMINATING",
        ScalingGroupId = tencentcloud_as_scaling_group.Example.Id,
        LifecycleCommand = new Tencentcloud.Inputs.AsLifecycleHookLifecycleCommandArgs
        {
            CommandId = "cmd-xxxx",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.AsLifecycleHook;
import com.pulumi.tencentcloud.AsLifecycleHookArgs;
import com.pulumi.tencentcloud.inputs.AsLifecycleHookLifecycleCommandArgs;
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) {
        var example = new AsLifecycleHook("example", AsLifecycleHookArgs.builder()
            .defaultResult("CONTINUE")
            .heartbeatTimeout(300)
            .lifecycleHookName("test")
            .lifecycleTransition("INSTANCE_TERMINATING")
            .scalingGroupId(tencentcloud_as_scaling_group.example().id())
            .lifecycleCommand(AsLifecycleHookLifecycleCommandArgs.builder()
                .commandId("cmd-xxxx")
                .build())
            .build());

    }
}
Copy
resources:
  example:
    type: tencentcloud:AsLifecycleHook
    properties:
      defaultResult: CONTINUE
      heartbeatTimeout: 300
      lifecycleHookName: test
      lifecycleTransition: INSTANCE_TERMINATING
      scalingGroupId: ${tencentcloud_as_scaling_group.example.id}
      lifecycleCommand:
        commandId: cmd-xxxx
Copy

Create AsLifecycleHook Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new AsLifecycleHook(name: string, args: AsLifecycleHookArgs, opts?: CustomResourceOptions);
@overload
def AsLifecycleHook(resource_name: str,
                    args: AsLifecycleHookArgs,
                    opts: Optional[ResourceOptions] = None)

@overload
def AsLifecycleHook(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    lifecycle_hook_name: Optional[str] = None,
                    lifecycle_transition: Optional[str] = None,
                    scaling_group_id: Optional[str] = None,
                    as_lifecycle_hook_id: Optional[str] = None,
                    default_result: Optional[str] = None,
                    heartbeat_timeout: Optional[float] = None,
                    lifecycle_command: Optional[AsLifecycleHookLifecycleCommandArgs] = None,
                    lifecycle_transition_type: Optional[str] = None,
                    notification_metadata: Optional[str] = None,
                    notification_queue_name: Optional[str] = None,
                    notification_target_type: Optional[str] = None,
                    notification_topic_name: Optional[str] = None)
func NewAsLifecycleHook(ctx *Context, name string, args AsLifecycleHookArgs, opts ...ResourceOption) (*AsLifecycleHook, error)
public AsLifecycleHook(string name, AsLifecycleHookArgs args, CustomResourceOptions? opts = null)
public AsLifecycleHook(String name, AsLifecycleHookArgs args)
public AsLifecycleHook(String name, AsLifecycleHookArgs args, CustomResourceOptions options)
type: tencentcloud:AsLifecycleHook
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AsLifecycleHookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AsLifecycleHookArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AsLifecycleHookArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AsLifecycleHookArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AsLifecycleHookArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

AsLifecycleHook Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The AsLifecycleHook resource accepts the following input properties:

LifecycleHookName This property is required. string
The name of the lifecycle hook.
LifecycleTransition This property is required. string
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
ScalingGroupId This property is required. string
ID of a scaling group.
AsLifecycleHookId string
ID of the resource.
DefaultResult string
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
HeartbeatTimeout double
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
LifecycleCommand AsLifecycleHookLifecycleCommand
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
LifecycleTransitionType string
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
NotificationMetadata string
Contains additional information that you want to include any time AS sends a message to the notification target.
NotificationQueueName string
For CMQ_QUEUE type, a name of queue must be set.
NotificationTargetType string
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
NotificationTopicName string
For CMQ_TOPIC type, a name of topic must be set.
LifecycleHookName This property is required. string
The name of the lifecycle hook.
LifecycleTransition This property is required. string
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
ScalingGroupId This property is required. string
ID of a scaling group.
AsLifecycleHookId string
ID of the resource.
DefaultResult string
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
HeartbeatTimeout float64
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
LifecycleCommand AsLifecycleHookLifecycleCommandArgs
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
LifecycleTransitionType string
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
NotificationMetadata string
Contains additional information that you want to include any time AS sends a message to the notification target.
NotificationQueueName string
For CMQ_QUEUE type, a name of queue must be set.
NotificationTargetType string
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
NotificationTopicName string
For CMQ_TOPIC type, a name of topic must be set.
lifecycleHookName This property is required. String
The name of the lifecycle hook.
lifecycleTransition This property is required. String
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
scalingGroupId This property is required. String
ID of a scaling group.
asLifecycleHookId String
ID of the resource.
defaultResult String
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeatTimeout Double
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycleCommand AsLifecycleHookLifecycleCommand
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycleTransitionType String
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notificationMetadata String
Contains additional information that you want to include any time AS sends a message to the notification target.
notificationQueueName String
For CMQ_QUEUE type, a name of queue must be set.
notificationTargetType String
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notificationTopicName String
For CMQ_TOPIC type, a name of topic must be set.
lifecycleHookName This property is required. string
The name of the lifecycle hook.
lifecycleTransition This property is required. string
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
scalingGroupId This property is required. string
ID of a scaling group.
asLifecycleHookId string
ID of the resource.
defaultResult string
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeatTimeout number
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycleCommand AsLifecycleHookLifecycleCommand
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycleTransitionType string
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notificationMetadata string
Contains additional information that you want to include any time AS sends a message to the notification target.
notificationQueueName string
For CMQ_QUEUE type, a name of queue must be set.
notificationTargetType string
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notificationTopicName string
For CMQ_TOPIC type, a name of topic must be set.
lifecycle_hook_name This property is required. str
The name of the lifecycle hook.
lifecycle_transition This property is required. str
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
scaling_group_id This property is required. str
ID of a scaling group.
as_lifecycle_hook_id str
ID of the resource.
default_result str
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeat_timeout float
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycle_command AsLifecycleHookLifecycleCommandArgs
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycle_transition_type str
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notification_metadata str
Contains additional information that you want to include any time AS sends a message to the notification target.
notification_queue_name str
For CMQ_QUEUE type, a name of queue must be set.
notification_target_type str
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notification_topic_name str
For CMQ_TOPIC type, a name of topic must be set.
lifecycleHookName This property is required. String
The name of the lifecycle hook.
lifecycleTransition This property is required. String
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
scalingGroupId This property is required. String
ID of a scaling group.
asLifecycleHookId String
ID of the resource.
defaultResult String
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeatTimeout Number
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycleCommand Property Map
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycleTransitionType String
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notificationMetadata String
Contains additional information that you want to include any time AS sends a message to the notification target.
notificationQueueName String
For CMQ_QUEUE type, a name of queue must be set.
notificationTargetType String
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notificationTopicName String
For CMQ_TOPIC type, a name of topic must be set.

Outputs

All input properties are implicitly available as output properties. Additionally, the AsLifecycleHook resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing AsLifecycleHook Resource

Get an existing AsLifecycleHook resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AsLifecycleHookState, opts?: CustomResourceOptions): AsLifecycleHook
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        as_lifecycle_hook_id: Optional[str] = None,
        default_result: Optional[str] = None,
        heartbeat_timeout: Optional[float] = None,
        lifecycle_command: Optional[AsLifecycleHookLifecycleCommandArgs] = None,
        lifecycle_hook_name: Optional[str] = None,
        lifecycle_transition: Optional[str] = None,
        lifecycle_transition_type: Optional[str] = None,
        notification_metadata: Optional[str] = None,
        notification_queue_name: Optional[str] = None,
        notification_target_type: Optional[str] = None,
        notification_topic_name: Optional[str] = None,
        scaling_group_id: Optional[str] = None) -> AsLifecycleHook
func GetAsLifecycleHook(ctx *Context, name string, id IDInput, state *AsLifecycleHookState, opts ...ResourceOption) (*AsLifecycleHook, error)
public static AsLifecycleHook Get(string name, Input<string> id, AsLifecycleHookState? state, CustomResourceOptions? opts = null)
public static AsLifecycleHook get(String name, Output<String> id, AsLifecycleHookState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:AsLifecycleHook    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AsLifecycleHookId string
ID of the resource.
DefaultResult string
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
HeartbeatTimeout double
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
LifecycleCommand AsLifecycleHookLifecycleCommand
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
LifecycleHookName string
The name of the lifecycle hook.
LifecycleTransition string
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
LifecycleTransitionType string
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
NotificationMetadata string
Contains additional information that you want to include any time AS sends a message to the notification target.
NotificationQueueName string
For CMQ_QUEUE type, a name of queue must be set.
NotificationTargetType string
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
NotificationTopicName string
For CMQ_TOPIC type, a name of topic must be set.
ScalingGroupId string
ID of a scaling group.
AsLifecycleHookId string
ID of the resource.
DefaultResult string
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
HeartbeatTimeout float64
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
LifecycleCommand AsLifecycleHookLifecycleCommandArgs
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
LifecycleHookName string
The name of the lifecycle hook.
LifecycleTransition string
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
LifecycleTransitionType string
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
NotificationMetadata string
Contains additional information that you want to include any time AS sends a message to the notification target.
NotificationQueueName string
For CMQ_QUEUE type, a name of queue must be set.
NotificationTargetType string
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
NotificationTopicName string
For CMQ_TOPIC type, a name of topic must be set.
ScalingGroupId string
ID of a scaling group.
asLifecycleHookId String
ID of the resource.
defaultResult String
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeatTimeout Double
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycleCommand AsLifecycleHookLifecycleCommand
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycleHookName String
The name of the lifecycle hook.
lifecycleTransition String
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
lifecycleTransitionType String
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notificationMetadata String
Contains additional information that you want to include any time AS sends a message to the notification target.
notificationQueueName String
For CMQ_QUEUE type, a name of queue must be set.
notificationTargetType String
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notificationTopicName String
For CMQ_TOPIC type, a name of topic must be set.
scalingGroupId String
ID of a scaling group.
asLifecycleHookId string
ID of the resource.
defaultResult string
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeatTimeout number
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycleCommand AsLifecycleHookLifecycleCommand
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycleHookName string
The name of the lifecycle hook.
lifecycleTransition string
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
lifecycleTransitionType string
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notificationMetadata string
Contains additional information that you want to include any time AS sends a message to the notification target.
notificationQueueName string
For CMQ_QUEUE type, a name of queue must be set.
notificationTargetType string
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notificationTopicName string
For CMQ_TOPIC type, a name of topic must be set.
scalingGroupId string
ID of a scaling group.
as_lifecycle_hook_id str
ID of the resource.
default_result str
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeat_timeout float
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycle_command AsLifecycleHookLifecycleCommandArgs
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycle_hook_name str
The name of the lifecycle hook.
lifecycle_transition str
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
lifecycle_transition_type str
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notification_metadata str
Contains additional information that you want to include any time AS sends a message to the notification target.
notification_queue_name str
For CMQ_QUEUE type, a name of queue must be set.
notification_target_type str
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notification_topic_name str
For CMQ_TOPIC type, a name of topic must be set.
scaling_group_id str
ID of a scaling group.
asLifecycleHookId String
ID of the resource.
defaultResult String
Defines the action the AS group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. Valid values: CONTINUE and ABANDON. The default value is CONTINUE.
heartbeatTimeout Number
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. Valid value ranges: (30~7200). and default value is 300.
lifecycleCommand Property Map
Remote command execution object. NotificationTarget and LifecycleCommand cannot be specified at the same time.
lifecycleHookName String
The name of the lifecycle hook.
lifecycleTransition String
The instance state to which you want to attach the lifecycle hook. Valid values: INSTANCE_LAUNCHING and INSTANCE_TERMINATING.
lifecycleTransitionType String
The scenario where the lifecycle hook is applied. EXTENSION: the lifecycle hook will be triggered when AttachInstances, DetachInstances or RemoveInstaces is called. NORMAL: the lifecycle hook is not triggered by the above APIs.
notificationMetadata String
Contains additional information that you want to include any time AS sends a message to the notification target.
notificationQueueName String
For CMQ_QUEUE type, a name of queue must be set.
notificationTargetType String
Target type. Valid values: CMQ_QUEUE, CMQ_TOPIC, TDMQ_CMQ_QUEUE, TDMQ_CMQ_TOPIC.
notificationTopicName String
For CMQ_TOPIC type, a name of topic must be set.
scalingGroupId String
ID of a scaling group.

Supporting Types

AsLifecycleHookLifecycleCommand
, AsLifecycleHookLifecycleCommandArgs

CommandId This property is required. string
Remote command ID. It is required to execute a command.
Parameters string
Custom parameter. The field type is JSON encoded string. For example, {"varA": "222"}.
CommandId This property is required. string
Remote command ID. It is required to execute a command.
Parameters string
Custom parameter. The field type is JSON encoded string. For example, {"varA": "222"}.
commandId This property is required. String
Remote command ID. It is required to execute a command.
parameters String
Custom parameter. The field type is JSON encoded string. For example, {"varA": "222"}.
commandId This property is required. string
Remote command ID. It is required to execute a command.
parameters string
Custom parameter. The field type is JSON encoded string. For example, {"varA": "222"}.
command_id This property is required. str
Remote command ID. It is required to execute a command.
parameters str
Custom parameter. The field type is JSON encoded string. For example, {"varA": "222"}.
commandId This property is required. String
Remote command ID. It is required to execute a command.
parameters String
Custom parameter. The field type is JSON encoded string. For example, {"varA": "222"}.

Import

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

$ pulumi import tencentcloud:index/asLifecycleHook:AsLifecycleHook example ash-ahg67203
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
tencentcloud tencentcloudstack/terraform-provider-tencentcloud
License
Notes
This Pulumi package is based on the tencentcloud Terraform Provider.