1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. MonitorTmpTkeAlertPolicy
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.MonitorTmpTkeAlertPolicy

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a tke tmpAlertPolicy

    NOTE: This resource will be deprecated in a future version, please use tencentcloud.MonitorTmpAlertGroup.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const config = new pulumi.Config();
    const defaultInstanceType = config.get("defaultInstanceType") || "SA1.MEDIUM2";
    const availabilityZoneFirst = config.get("availabilityZoneFirst") || "ap-guangzhou-3";
    const availabilityZoneSecond = config.get("availabilityZoneSecond") || "ap-guangzhou-4";
    const exampleClusterCidr = config.get("exampleClusterCidr") || "10.31.0.0/16";
    const vpcOne = tencentcloud.getVpcSubnets({
        isDefault: true,
        availabilityZone: availabilityZoneFirst,
    });
    const firstVpcId = vpcOne.then(vpcOne => vpcOne.instanceLists?.[0]?.vpcId);
    const firstSubnetId = vpcOne.then(vpcOne => vpcOne.instanceLists?.[0]?.subnetId);
    const vpcTwo = tencentcloud.getVpcSubnets({
        isDefault: true,
        availabilityZone: availabilityZoneSecond,
    });
    const secondVpcId = vpcTwo.then(vpcTwo => vpcTwo.instanceLists?.[0]?.vpcId);
    const secondSubnetId = vpcTwo.then(vpcTwo => vpcTwo.instanceLists?.[0]?.subnetId);
    const sg = new tencentcloud.SecurityGroup("sg", {});
    const sgId = sg.securityGroupId;
    const _default = tencentcloud.getImages({
        imageTypes: ["PUBLIC_IMAGE"],
        imageNameRegex: "Final",
    });
    const imageId = _default.then(_default => _default.imageId);
    const sgRule = new tencentcloud.SecurityGroupLiteRule("sgRule", {
        securityGroupId: sg.securityGroupId,
        ingresses: [
            "ACCEPT#10.0.0.0/16#ALL#ALL",
            "ACCEPT#172.16.0.0/22#ALL#ALL",
            "DROP#0.0.0.0/0#ALL#ALL",
        ],
        egresses: ["ACCEPT#172.16.0.0/22#ALL#ALL"],
    });
    const example = new tencentcloud.KubernetesCluster("example", {
        vpcId: firstVpcId,
        clusterCidr: exampleClusterCidr,
        clusterMaxPodNum: 32,
        clusterName: "tf_example_cluster",
        clusterDesc: "example for tke cluster",
        clusterMaxServiceNum: 32,
        clusterInternet: false,
        clusterInternetSecurityGroup: sgId,
        clusterVersion: "1.22.5",
        clusterDeployType: "MANAGED_CLUSTER",
        workerConfigs: [
            {
                count: 1,
                availabilityZone: availabilityZoneFirst,
                instanceType: defaultInstanceType,
                systemDiskType: "CLOUD_SSD",
                systemDiskSize: 60,
                internetChargeType: "TRAFFIC_POSTPAID_BY_HOUR",
                internetMaxBandwidthOut: 100,
                publicIpAssigned: true,
                subnetId: firstSubnetId,
                imgId: imageId,
                dataDisks: [{
                    diskType: "CLOUD_PREMIUM",
                    diskSize: 50,
                }],
                enhancedSecurityService: false,
                enhancedMonitorService: false,
                userData: "dGVzdA==",
                password: "ZZXXccvv1212",
            },
            {
                count: 1,
                availabilityZone: availabilityZoneSecond,
                instanceType: defaultInstanceType,
                systemDiskType: "CLOUD_SSD",
                systemDiskSize: 60,
                internetChargeType: "TRAFFIC_POSTPAID_BY_HOUR",
                internetMaxBandwidthOut: 100,
                publicIpAssigned: true,
                subnetId: secondSubnetId,
                dataDisks: [{
                    diskType: "CLOUD_PREMIUM",
                    diskSize: 50,
                }],
                enhancedSecurityService: false,
                enhancedMonitorService: false,
                userData: "dGVzdA==",
                camRoleName: "CVM_QcsRole",
                password: "ZZXXccvv1212",
            },
        ],
        labels: {
            test1: "test1",
            test2: "test2",
        },
    });
    const zone = config.get("zone") || "ap-guangzhou";
    const clusterType = config.get("clusterType") || "tke";
    const fooMonitorTmpInstance = new tencentcloud.MonitorTmpInstance("fooMonitorTmpInstance", {
        instanceName: "tf-tmp-instance",
        vpcId: firstVpcId,
        subnetId: firstSubnetId,
        dataRetentionTime: 30,
        zone: availabilityZoneSecond,
        tags: {
            createdBy: "terraform",
        },
    });
    // tmp tke bind
    const fooMonitorTmpTkeClusterAgent = new tencentcloud.MonitorTmpTkeClusterAgent("fooMonitorTmpTkeClusterAgent", {
        instanceId: fooMonitorTmpInstance.monitorTmpInstanceId,
        agents: {
            region: zone,
            clusterType: clusterType,
            clusterId: example.kubernetesClusterId,
            enableExternal: false,
        },
    });
    // create record rule
    const basic = new tencentcloud.MonitorTmpTkeAlertPolicy("basic", {
        instanceId: fooMonitorTmpInstance.monitorTmpInstanceId,
        alertRule: {
            name: "alert_rule-test",
            rules: [{
                name: "rules-test",
                rule: "(count(kube_node_status_allocatable_cpu_cores) by (cluster) -1)   / count(kube_node_status_allocatable_cpu_cores) by (cluster)",
                template: "The CPU requested by the Pod in the cluster {{ $labels.cluster }} is overloaded, and the current CPU application ratio is {{ $value | humanizePercentage }}",
                "for": "5m",
                labels: [{
                    name: "severity",
                    value: "warning",
                }],
            }],
            notification: {
                type: "amp",
                enabled: true,
                alertManager: {
                    url: "xxx",
                },
            },
        },
    }, {
        dependsOn: [fooMonitorTmpTkeClusterAgent],
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    config = pulumi.Config()
    default_instance_type = config.get("defaultInstanceType")
    if default_instance_type is None:
        default_instance_type = "SA1.MEDIUM2"
    availability_zone_first = config.get("availabilityZoneFirst")
    if availability_zone_first is None:
        availability_zone_first = "ap-guangzhou-3"
    availability_zone_second = config.get("availabilityZoneSecond")
    if availability_zone_second is None:
        availability_zone_second = "ap-guangzhou-4"
    example_cluster_cidr = config.get("exampleClusterCidr")
    if example_cluster_cidr is None:
        example_cluster_cidr = "10.31.0.0/16"
    vpc_one = tencentcloud.get_vpc_subnets(is_default=True,
        availability_zone=availability_zone_first)
    first_vpc_id = vpc_one.instance_lists[0].vpc_id
    first_subnet_id = vpc_one.instance_lists[0].subnet_id
    vpc_two = tencentcloud.get_vpc_subnets(is_default=True,
        availability_zone=availability_zone_second)
    second_vpc_id = vpc_two.instance_lists[0].vpc_id
    second_subnet_id = vpc_two.instance_lists[0].subnet_id
    sg = tencentcloud.SecurityGroup("sg")
    sg_id = sg.security_group_id
    default = tencentcloud.get_images(image_types=["PUBLIC_IMAGE"],
        image_name_regex="Final")
    image_id = default.image_id
    sg_rule = tencentcloud.SecurityGroupLiteRule("sgRule",
        security_group_id=sg.security_group_id,
        ingresses=[
            "ACCEPT#10.0.0.0/16#ALL#ALL",
            "ACCEPT#172.16.0.0/22#ALL#ALL",
            "DROP#0.0.0.0/0#ALL#ALL",
        ],
        egresses=["ACCEPT#172.16.0.0/22#ALL#ALL"])
    example = tencentcloud.KubernetesCluster("example",
        vpc_id=first_vpc_id,
        cluster_cidr=example_cluster_cidr,
        cluster_max_pod_num=32,
        cluster_name="tf_example_cluster",
        cluster_desc="example for tke cluster",
        cluster_max_service_num=32,
        cluster_internet=False,
        cluster_internet_security_group=sg_id,
        cluster_version="1.22.5",
        cluster_deploy_type="MANAGED_CLUSTER",
        worker_configs=[
            {
                "count": 1,
                "availability_zone": availability_zone_first,
                "instance_type": default_instance_type,
                "system_disk_type": "CLOUD_SSD",
                "system_disk_size": 60,
                "internet_charge_type": "TRAFFIC_POSTPAID_BY_HOUR",
                "internet_max_bandwidth_out": 100,
                "public_ip_assigned": True,
                "subnet_id": first_subnet_id,
                "img_id": image_id,
                "data_disks": [{
                    "disk_type": "CLOUD_PREMIUM",
                    "disk_size": 50,
                }],
                "enhanced_security_service": False,
                "enhanced_monitor_service": False,
                "user_data": "dGVzdA==",
                "password": "ZZXXccvv1212",
            },
            {
                "count": 1,
                "availability_zone": availability_zone_second,
                "instance_type": default_instance_type,
                "system_disk_type": "CLOUD_SSD",
                "system_disk_size": 60,
                "internet_charge_type": "TRAFFIC_POSTPAID_BY_HOUR",
                "internet_max_bandwidth_out": 100,
                "public_ip_assigned": True,
                "subnet_id": second_subnet_id,
                "data_disks": [{
                    "disk_type": "CLOUD_PREMIUM",
                    "disk_size": 50,
                }],
                "enhanced_security_service": False,
                "enhanced_monitor_service": False,
                "user_data": "dGVzdA==",
                "cam_role_name": "CVM_QcsRole",
                "password": "ZZXXccvv1212",
            },
        ],
        labels={
            "test1": "test1",
            "test2": "test2",
        })
    zone = config.get("zone")
    if zone is None:
        zone = "ap-guangzhou"
    cluster_type = config.get("clusterType")
    if cluster_type is None:
        cluster_type = "tke"
    foo_monitor_tmp_instance = tencentcloud.MonitorTmpInstance("fooMonitorTmpInstance",
        instance_name="tf-tmp-instance",
        vpc_id=first_vpc_id,
        subnet_id=first_subnet_id,
        data_retention_time=30,
        zone=availability_zone_second,
        tags={
            "createdBy": "terraform",
        })
    # tmp tke bind
    foo_monitor_tmp_tke_cluster_agent = tencentcloud.MonitorTmpTkeClusterAgent("fooMonitorTmpTkeClusterAgent",
        instance_id=foo_monitor_tmp_instance.monitor_tmp_instance_id,
        agents={
            "region": zone,
            "cluster_type": cluster_type,
            "cluster_id": example.kubernetes_cluster_id,
            "enable_external": False,
        })
    # create record rule
    basic = tencentcloud.MonitorTmpTkeAlertPolicy("basic",
        instance_id=foo_monitor_tmp_instance.monitor_tmp_instance_id,
        alert_rule={
            "name": "alert_rule-test",
            "rules": [{
                "name": "rules-test",
                "rule": "(count(kube_node_status_allocatable_cpu_cores) by (cluster) -1)   / count(kube_node_status_allocatable_cpu_cores) by (cluster)",
                "template": "The CPU requested by the Pod in the cluster {{ $labels.cluster }} is overloaded, and the current CPU application ratio is {{ $value | humanizePercentage }}",
                "for_": "5m",
                "labels": [{
                    "name": "severity",
                    "value": "warning",
                }],
            }],
            "notification": {
                "type": "amp",
                "enabled": True,
                "alert_manager": {
                    "url": "xxx",
                },
            },
        },
        opts = pulumi.ResourceOptions(depends_on=[foo_monitor_tmp_tke_cluster_agent]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		defaultInstanceType := "SA1.MEDIUM2"
    		if param := cfg.Get("defaultInstanceType"); param != "" {
    			defaultInstanceType = param
    		}
    		availabilityZoneFirst := "ap-guangzhou-3"
    		if param := cfg.Get("availabilityZoneFirst"); param != "" {
    			availabilityZoneFirst = param
    		}
    		availabilityZoneSecond := "ap-guangzhou-4"
    		if param := cfg.Get("availabilityZoneSecond"); param != "" {
    			availabilityZoneSecond = param
    		}
    		exampleClusterCidr := "10.31.0.0/16"
    		if param := cfg.Get("exampleClusterCidr"); param != "" {
    			exampleClusterCidr = param
    		}
    		vpcOne, err := tencentcloud.GetVpcSubnets(ctx, &tencentcloud.GetVpcSubnetsArgs{
    			IsDefault:        pulumi.BoolRef(true),
    			AvailabilityZone: pulumi.StringRef(availabilityZoneFirst),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		firstVpcId := vpcOne.InstanceLists[0].VpcId
    		firstSubnetId := vpcOne.InstanceLists[0].SubnetId
    		vpcTwo, err := tencentcloud.GetVpcSubnets(ctx, &tencentcloud.GetVpcSubnetsArgs{
    			IsDefault:        pulumi.BoolRef(true),
    			AvailabilityZone: pulumi.StringRef(availabilityZoneSecond),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_ := vpcTwo.InstanceLists[0].VpcId
    		secondSubnetId := vpcTwo.InstanceLists[0].SubnetId
    		sg, err := tencentcloud.NewSecurityGroup(ctx, "sg", nil)
    		if err != nil {
    			return err
    		}
    		sgId := sg.SecurityGroupId
    		_default, err := tencentcloud.GetImages(ctx, &tencentcloud.GetImagesArgs{
    			ImageTypes: []string{
    				"PUBLIC_IMAGE",
    			},
    			ImageNameRegex: pulumi.StringRef("Final"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		imageId := _default.ImageId
    		_, err = tencentcloud.NewSecurityGroupLiteRule(ctx, "sgRule", &tencentcloud.SecurityGroupLiteRuleArgs{
    			SecurityGroupId: sg.SecurityGroupId,
    			Ingresses: pulumi.StringArray{
    				pulumi.String("ACCEPT#10.0.0.0/16#ALL#ALL"),
    				pulumi.String("ACCEPT#172.16.0.0/22#ALL#ALL"),
    				pulumi.String("DROP#0.0.0.0/0#ALL#ALL"),
    			},
    			Egresses: pulumi.StringArray{
    				pulumi.String("ACCEPT#172.16.0.0/22#ALL#ALL"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		example, err := tencentcloud.NewKubernetesCluster(ctx, "example", &tencentcloud.KubernetesClusterArgs{
    			VpcId:                        pulumi.String(firstVpcId),
    			ClusterCidr:                  pulumi.String(exampleClusterCidr),
    			ClusterMaxPodNum:             pulumi.Float64(32),
    			ClusterName:                  pulumi.String("tf_example_cluster"),
    			ClusterDesc:                  pulumi.String("example for tke cluster"),
    			ClusterMaxServiceNum:         pulumi.Float64(32),
    			ClusterInternet:              pulumi.Bool(false),
    			ClusterInternetSecurityGroup: pulumi.String(sgId),
    			ClusterVersion:               pulumi.String("1.22.5"),
    			ClusterDeployType:            pulumi.String("MANAGED_CLUSTER"),
    			WorkerConfigs: tencentcloud.KubernetesClusterWorkerConfigArray{
    				&tencentcloud.KubernetesClusterWorkerConfigArgs{
    					Count:                   pulumi.Float64(1),
    					AvailabilityZone:        pulumi.String(availabilityZoneFirst),
    					InstanceType:            pulumi.String(defaultInstanceType),
    					SystemDiskType:          pulumi.String("CLOUD_SSD"),
    					SystemDiskSize:          pulumi.Float64(60),
    					InternetChargeType:      pulumi.String("TRAFFIC_POSTPAID_BY_HOUR"),
    					InternetMaxBandwidthOut: pulumi.Float64(100),
    					PublicIpAssigned:        pulumi.Bool(true),
    					SubnetId:                pulumi.String(firstSubnetId),
    					ImgId:                   pulumi.String(imageId),
    					DataDisks: tencentcloud.KubernetesClusterWorkerConfigDataDiskArray{
    						&tencentcloud.KubernetesClusterWorkerConfigDataDiskArgs{
    							DiskType: pulumi.String("CLOUD_PREMIUM"),
    							DiskSize: pulumi.Float64(50),
    						},
    					},
    					EnhancedSecurityService: pulumi.Bool(false),
    					EnhancedMonitorService:  pulumi.Bool(false),
    					UserData:                pulumi.String("dGVzdA=="),
    					Password:                pulumi.String("ZZXXccvv1212"),
    				},
    				&tencentcloud.KubernetesClusterWorkerConfigArgs{
    					Count:                   pulumi.Float64(1),
    					AvailabilityZone:        pulumi.String(availabilityZoneSecond),
    					InstanceType:            pulumi.String(defaultInstanceType),
    					SystemDiskType:          pulumi.String("CLOUD_SSD"),
    					SystemDiskSize:          pulumi.Float64(60),
    					InternetChargeType:      pulumi.String("TRAFFIC_POSTPAID_BY_HOUR"),
    					InternetMaxBandwidthOut: pulumi.Float64(100),
    					PublicIpAssigned:        pulumi.Bool(true),
    					SubnetId:                pulumi.String(secondSubnetId),
    					DataDisks: tencentcloud.KubernetesClusterWorkerConfigDataDiskArray{
    						&tencentcloud.KubernetesClusterWorkerConfigDataDiskArgs{
    							DiskType: pulumi.String("CLOUD_PREMIUM"),
    							DiskSize: pulumi.Float64(50),
    						},
    					},
    					EnhancedSecurityService: pulumi.Bool(false),
    					EnhancedMonitorService:  pulumi.Bool(false),
    					UserData:                pulumi.String("dGVzdA=="),
    					CamRoleName:             pulumi.String("CVM_QcsRole"),
    					Password:                pulumi.String("ZZXXccvv1212"),
    				},
    			},
    			Labels: pulumi.StringMap{
    				"test1": pulumi.String("test1"),
    				"test2": pulumi.String("test2"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		zone := "ap-guangzhou"
    		if param := cfg.Get("zone"); param != "" {
    			zone = param
    		}
    		clusterType := "tke"
    		if param := cfg.Get("clusterType"); param != "" {
    			clusterType = param
    		}
    		fooMonitorTmpInstance, err := tencentcloud.NewMonitorTmpInstance(ctx, "fooMonitorTmpInstance", &tencentcloud.MonitorTmpInstanceArgs{
    			InstanceName:      pulumi.String("tf-tmp-instance"),
    			VpcId:             pulumi.String(firstVpcId),
    			SubnetId:          pulumi.String(firstSubnetId),
    			DataRetentionTime: pulumi.Float64(30),
    			Zone:              pulumi.String(availabilityZoneSecond),
    			Tags: pulumi.StringMap{
    				"createdBy": pulumi.String("terraform"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// tmp tke bind
    		fooMonitorTmpTkeClusterAgent, err := tencentcloud.NewMonitorTmpTkeClusterAgent(ctx, "fooMonitorTmpTkeClusterAgent", &tencentcloud.MonitorTmpTkeClusterAgentArgs{
    			InstanceId: fooMonitorTmpInstance.MonitorTmpInstanceId,
    			Agents: &tencentcloud.MonitorTmpTkeClusterAgentAgentsArgs{
    				Region:         pulumi.String(zone),
    				ClusterType:    pulumi.String(clusterType),
    				ClusterId:      example.KubernetesClusterId,
    				EnableExternal: pulumi.Bool(false),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// create record rule
    		_, err = tencentcloud.NewMonitorTmpTkeAlertPolicy(ctx, "basic", &tencentcloud.MonitorTmpTkeAlertPolicyArgs{
    			InstanceId: fooMonitorTmpInstance.MonitorTmpInstanceId,
    			AlertRule: &tencentcloud.MonitorTmpTkeAlertPolicyAlertRuleArgs{
    				Name: pulumi.String("alert_rule-test"),
    				Rules: tencentcloud.MonitorTmpTkeAlertPolicyAlertRuleRuleArray{
    					&tencentcloud.MonitorTmpTkeAlertPolicyAlertRuleRuleArgs{
    						Name:     pulumi.String("rules-test"),
    						Rule:     pulumi.String("(count(kube_node_status_allocatable_cpu_cores) by (cluster) -1)   / count(kube_node_status_allocatable_cpu_cores) by (cluster)"),
    						Template: pulumi.String("The CPU requested by the Pod in the cluster {{ $labels.cluster }} is overloaded, and the current CPU application ratio is {{ $value | humanizePercentage }}"),
    						For:      pulumi.String("5m"),
    						Labels: tencentcloud.MonitorTmpTkeAlertPolicyAlertRuleRuleLabelArray{
    							&tencentcloud.MonitorTmpTkeAlertPolicyAlertRuleRuleLabelArgs{
    								Name:  pulumi.String("severity"),
    								Value: pulumi.String("warning"),
    							},
    						},
    					},
    				},
    				Notification: &tencentcloud.MonitorTmpTkeAlertPolicyAlertRuleNotificationArgs{
    					Type:    pulumi.String("amp"),
    					Enabled: pulumi.Bool(true),
    					AlertManager: &tencentcloud.MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManagerArgs{
    						Url: pulumi.String("xxx"),
    					},
    				},
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			fooMonitorTmpTkeClusterAgent,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var defaultInstanceType = config.Get("defaultInstanceType") ?? "SA1.MEDIUM2";
        var availabilityZoneFirst = config.Get("availabilityZoneFirst") ?? "ap-guangzhou-3";
        var availabilityZoneSecond = config.Get("availabilityZoneSecond") ?? "ap-guangzhou-4";
        var exampleClusterCidr = config.Get("exampleClusterCidr") ?? "10.31.0.0/16";
        var vpcOne = Tencentcloud.GetVpcSubnets.Invoke(new()
        {
            IsDefault = true,
            AvailabilityZone = availabilityZoneFirst,
        });
    
        var firstVpcId = vpcOne.Apply(getVpcSubnetsResult => getVpcSubnetsResult.InstanceLists[0]?.VpcId);
    
        var firstSubnetId = vpcOne.Apply(getVpcSubnetsResult => getVpcSubnetsResult.InstanceLists[0]?.SubnetId);
    
        var vpcTwo = Tencentcloud.GetVpcSubnets.Invoke(new()
        {
            IsDefault = true,
            AvailabilityZone = availabilityZoneSecond,
        });
    
        var secondVpcId = vpcTwo.Apply(getVpcSubnetsResult => getVpcSubnetsResult.InstanceLists[0]?.VpcId);
    
        var secondSubnetId = vpcTwo.Apply(getVpcSubnetsResult => getVpcSubnetsResult.InstanceLists[0]?.SubnetId);
    
        var sg = new Tencentcloud.SecurityGroup("sg");
    
        var sgId = sg.SecurityGroupId;
    
        var @default = Tencentcloud.GetImages.Invoke(new()
        {
            ImageTypes = new[]
            {
                "PUBLIC_IMAGE",
            },
            ImageNameRegex = "Final",
        });
    
        var imageId = @default.Apply(@default => @default.Apply(getImagesResult => getImagesResult.ImageId));
    
        var sgRule = new Tencentcloud.SecurityGroupLiteRule("sgRule", new()
        {
            SecurityGroupId = sg.SecurityGroupId,
            Ingresses = new[]
            {
                "ACCEPT#10.0.0.0/16#ALL#ALL",
                "ACCEPT#172.16.0.0/22#ALL#ALL",
                "DROP#0.0.0.0/0#ALL#ALL",
            },
            Egresses = new[]
            {
                "ACCEPT#172.16.0.0/22#ALL#ALL",
            },
        });
    
        var example = new Tencentcloud.KubernetesCluster("example", new()
        {
            VpcId = firstVpcId,
            ClusterCidr = exampleClusterCidr,
            ClusterMaxPodNum = 32,
            ClusterName = "tf_example_cluster",
            ClusterDesc = "example for tke cluster",
            ClusterMaxServiceNum = 32,
            ClusterInternet = false,
            ClusterInternetSecurityGroup = sgId,
            ClusterVersion = "1.22.5",
            ClusterDeployType = "MANAGED_CLUSTER",
            WorkerConfigs = new[]
            {
                new Tencentcloud.Inputs.KubernetesClusterWorkerConfigArgs
                {
                    Count = 1,
                    AvailabilityZone = availabilityZoneFirst,
                    InstanceType = defaultInstanceType,
                    SystemDiskType = "CLOUD_SSD",
                    SystemDiskSize = 60,
                    InternetChargeType = "TRAFFIC_POSTPAID_BY_HOUR",
                    InternetMaxBandwidthOut = 100,
                    PublicIpAssigned = true,
                    SubnetId = firstSubnetId,
                    ImgId = imageId,
                    DataDisks = new[]
                    {
                        new Tencentcloud.Inputs.KubernetesClusterWorkerConfigDataDiskArgs
                        {
                            DiskType = "CLOUD_PREMIUM",
                            DiskSize = 50,
                        },
                    },
                    EnhancedSecurityService = false,
                    EnhancedMonitorService = false,
                    UserData = "dGVzdA==",
                    Password = "ZZXXccvv1212",
                },
                new Tencentcloud.Inputs.KubernetesClusterWorkerConfigArgs
                {
                    Count = 1,
                    AvailabilityZone = availabilityZoneSecond,
                    InstanceType = defaultInstanceType,
                    SystemDiskType = "CLOUD_SSD",
                    SystemDiskSize = 60,
                    InternetChargeType = "TRAFFIC_POSTPAID_BY_HOUR",
                    InternetMaxBandwidthOut = 100,
                    PublicIpAssigned = true,
                    SubnetId = secondSubnetId,
                    DataDisks = new[]
                    {
                        new Tencentcloud.Inputs.KubernetesClusterWorkerConfigDataDiskArgs
                        {
                            DiskType = "CLOUD_PREMIUM",
                            DiskSize = 50,
                        },
                    },
                    EnhancedSecurityService = false,
                    EnhancedMonitorService = false,
                    UserData = "dGVzdA==",
                    CamRoleName = "CVM_QcsRole",
                    Password = "ZZXXccvv1212",
                },
            },
            Labels = 
            {
                { "test1", "test1" },
                { "test2", "test2" },
            },
        });
    
        var zone = config.Get("zone") ?? "ap-guangzhou";
        var clusterType = config.Get("clusterType") ?? "tke";
        var fooMonitorTmpInstance = new Tencentcloud.MonitorTmpInstance("fooMonitorTmpInstance", new()
        {
            InstanceName = "tf-tmp-instance",
            VpcId = firstVpcId,
            SubnetId = firstSubnetId,
            DataRetentionTime = 30,
            Zone = availabilityZoneSecond,
            Tags = 
            {
                { "createdBy", "terraform" },
            },
        });
    
        // tmp tke bind
        var fooMonitorTmpTkeClusterAgent = new Tencentcloud.MonitorTmpTkeClusterAgent("fooMonitorTmpTkeClusterAgent", new()
        {
            InstanceId = fooMonitorTmpInstance.MonitorTmpInstanceId,
            Agents = new Tencentcloud.Inputs.MonitorTmpTkeClusterAgentAgentsArgs
            {
                Region = zone,
                ClusterType = clusterType,
                ClusterId = example.KubernetesClusterId,
                EnableExternal = false,
            },
        });
    
        // create record rule
        var basic = new Tencentcloud.MonitorTmpTkeAlertPolicy("basic", new()
        {
            InstanceId = fooMonitorTmpInstance.MonitorTmpInstanceId,
            AlertRule = new Tencentcloud.Inputs.MonitorTmpTkeAlertPolicyAlertRuleArgs
            {
                Name = "alert_rule-test",
                Rules = new[]
                {
                    new Tencentcloud.Inputs.MonitorTmpTkeAlertPolicyAlertRuleRuleArgs
                    {
                        Name = "rules-test",
                        Rule = "(count(kube_node_status_allocatable_cpu_cores) by (cluster) -1)   / count(kube_node_status_allocatable_cpu_cores) by (cluster)",
                        Template = "The CPU requested by the Pod in the cluster {{ $labels.cluster }} is overloaded, and the current CPU application ratio is {{ $value | humanizePercentage }}",
                        For = "5m",
                        Labels = new[]
                        {
                            new Tencentcloud.Inputs.MonitorTmpTkeAlertPolicyAlertRuleRuleLabelArgs
                            {
                                Name = "severity",
                                Value = "warning",
                            },
                        },
                    },
                },
                Notification = new Tencentcloud.Inputs.MonitorTmpTkeAlertPolicyAlertRuleNotificationArgs
                {
                    Type = "amp",
                    Enabled = true,
                    AlertManager = new Tencentcloud.Inputs.MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManagerArgs
                    {
                        Url = "xxx",
                    },
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                fooMonitorTmpTkeClusterAgent,
            },
        });
    
    });
    
    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.GetVpcSubnetsArgs;
    import com.pulumi.tencentcloud.SecurityGroup;
    import com.pulumi.tencentcloud.inputs.GetImagesArgs;
    import com.pulumi.tencentcloud.SecurityGroupLiteRule;
    import com.pulumi.tencentcloud.SecurityGroupLiteRuleArgs;
    import com.pulumi.tencentcloud.KubernetesCluster;
    import com.pulumi.tencentcloud.KubernetesClusterArgs;
    import com.pulumi.tencentcloud.inputs.KubernetesClusterWorkerConfigArgs;
    import com.pulumi.tencentcloud.MonitorTmpInstance;
    import com.pulumi.tencentcloud.MonitorTmpInstanceArgs;
    import com.pulumi.tencentcloud.MonitorTmpTkeClusterAgent;
    import com.pulumi.tencentcloud.MonitorTmpTkeClusterAgentArgs;
    import com.pulumi.tencentcloud.inputs.MonitorTmpTkeClusterAgentAgentsArgs;
    import com.pulumi.tencentcloud.MonitorTmpTkeAlertPolicy;
    import com.pulumi.tencentcloud.MonitorTmpTkeAlertPolicyArgs;
    import com.pulumi.tencentcloud.inputs.MonitorTmpTkeAlertPolicyAlertRuleArgs;
    import com.pulumi.tencentcloud.inputs.MonitorTmpTkeAlertPolicyAlertRuleNotificationArgs;
    import com.pulumi.tencentcloud.inputs.MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManagerArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 defaultInstanceType = config.get("defaultInstanceType").orElse("SA1.MEDIUM2");
            final var availabilityZoneFirst = config.get("availabilityZoneFirst").orElse("ap-guangzhou-3");
            final var availabilityZoneSecond = config.get("availabilityZoneSecond").orElse("ap-guangzhou-4");
            final var exampleClusterCidr = config.get("exampleClusterCidr").orElse("10.31.0.0/16");
            final var vpcOne = TencentcloudFunctions.getVpcSubnets(GetVpcSubnetsArgs.builder()
                .isDefault(true)
                .availabilityZone(availabilityZoneFirst)
                .build());
    
            final var firstVpcId = vpcOne.applyValue(getVpcSubnetsResult -> getVpcSubnetsResult.instanceLists()[0].vpcId());
    
            final var firstSubnetId = vpcOne.applyValue(getVpcSubnetsResult -> getVpcSubnetsResult.instanceLists()[0].subnetId());
    
            final var vpcTwo = TencentcloudFunctions.getVpcSubnets(GetVpcSubnetsArgs.builder()
                .isDefault(true)
                .availabilityZone(availabilityZoneSecond)
                .build());
    
            final var secondVpcId = vpcTwo.applyValue(getVpcSubnetsResult -> getVpcSubnetsResult.instanceLists()[0].vpcId());
    
            final var secondSubnetId = vpcTwo.applyValue(getVpcSubnetsResult -> getVpcSubnetsResult.instanceLists()[0].subnetId());
    
            var sg = new SecurityGroup("sg");
    
            final var sgId = sg.securityGroupId();
    
            final var default = TencentcloudFunctions.getImages(GetImagesArgs.builder()
                .imageTypes("PUBLIC_IMAGE")
                .imageNameRegex("Final")
                .build());
    
            final var imageId = default_.imageId();
    
            var sgRule = new SecurityGroupLiteRule("sgRule", SecurityGroupLiteRuleArgs.builder()
                .securityGroupId(sg.securityGroupId())
                .ingresses(            
                    "ACCEPT#10.0.0.0/16#ALL#ALL",
                    "ACCEPT#172.16.0.0/22#ALL#ALL",
                    "DROP#0.0.0.0/0#ALL#ALL")
                .egresses("ACCEPT#172.16.0.0/22#ALL#ALL")
                .build());
    
            var example = new KubernetesCluster("example", KubernetesClusterArgs.builder()
                .vpcId(firstVpcId)
                .clusterCidr(exampleClusterCidr)
                .clusterMaxPodNum(32)
                .clusterName("tf_example_cluster")
                .clusterDesc("example for tke cluster")
                .clusterMaxServiceNum(32)
                .clusterInternet(false)
                .clusterInternetSecurityGroup(sgId)
                .clusterVersion("1.22.5")
                .clusterDeployType("MANAGED_CLUSTER")
                .workerConfigs(            
                    KubernetesClusterWorkerConfigArgs.builder()
                        .count(1)
                        .availabilityZone(availabilityZoneFirst)
                        .instanceType(defaultInstanceType)
                        .systemDiskType("CLOUD_SSD")
                        .systemDiskSize(60)
                        .internetChargeType("TRAFFIC_POSTPAID_BY_HOUR")
                        .internetMaxBandwidthOut(100)
                        .publicIpAssigned(true)
                        .subnetId(firstSubnetId)
                        .imgId(imageId)
                        .dataDisks(KubernetesClusterWorkerConfigDataDiskArgs.builder()
                            .diskType("CLOUD_PREMIUM")
                            .diskSize(50)
                            .build())
                        .enhancedSecurityService(false)
                        .enhancedMonitorService(false)
                        .userData("dGVzdA==")
                        .password("ZZXXccvv1212")
                        .build(),
                    KubernetesClusterWorkerConfigArgs.builder()
                        .count(1)
                        .availabilityZone(availabilityZoneSecond)
                        .instanceType(defaultInstanceType)
                        .systemDiskType("CLOUD_SSD")
                        .systemDiskSize(60)
                        .internetChargeType("TRAFFIC_POSTPAID_BY_HOUR")
                        .internetMaxBandwidthOut(100)
                        .publicIpAssigned(true)
                        .subnetId(secondSubnetId)
                        .dataDisks(KubernetesClusterWorkerConfigDataDiskArgs.builder()
                            .diskType("CLOUD_PREMIUM")
                            .diskSize(50)
                            .build())
                        .enhancedSecurityService(false)
                        .enhancedMonitorService(false)
                        .userData("dGVzdA==")
                        .camRoleName("CVM_QcsRole")
                        .password("ZZXXccvv1212")
                        .build())
                .labels(Map.ofEntries(
                    Map.entry("test1", "test1"),
                    Map.entry("test2", "test2")
                ))
                .build());
    
            final var zone = config.get("zone").orElse("ap-guangzhou");
            final var clusterType = config.get("clusterType").orElse("tke");
            var fooMonitorTmpInstance = new MonitorTmpInstance("fooMonitorTmpInstance", MonitorTmpInstanceArgs.builder()
                .instanceName("tf-tmp-instance")
                .vpcId(firstVpcId)
                .subnetId(firstSubnetId)
                .dataRetentionTime(30)
                .zone(availabilityZoneSecond)
                .tags(Map.of("createdBy", "terraform"))
                .build());
    
            // tmp tke bind
            var fooMonitorTmpTkeClusterAgent = new MonitorTmpTkeClusterAgent("fooMonitorTmpTkeClusterAgent", MonitorTmpTkeClusterAgentArgs.builder()
                .instanceId(fooMonitorTmpInstance.monitorTmpInstanceId())
                .agents(MonitorTmpTkeClusterAgentAgentsArgs.builder()
                    .region(zone)
                    .clusterType(clusterType)
                    .clusterId(example.kubernetesClusterId())
                    .enableExternal(false)
                    .build())
                .build());
    
            // create record rule
            var basic = new MonitorTmpTkeAlertPolicy("basic", MonitorTmpTkeAlertPolicyArgs.builder()
                .instanceId(fooMonitorTmpInstance.monitorTmpInstanceId())
                .alertRule(MonitorTmpTkeAlertPolicyAlertRuleArgs.builder()
                    .name("alert_rule-test")
                    .rules(MonitorTmpTkeAlertPolicyAlertRuleRuleArgs.builder()
                        .name("rules-test")
                        .rule("(count(kube_node_status_allocatable_cpu_cores) by (cluster) -1)   / count(kube_node_status_allocatable_cpu_cores) by (cluster)")
                        .template("The CPU requested by the Pod in the cluster {{ $labels.cluster }} is overloaded, and the current CPU application ratio is {{ $value | humanizePercentage }}")
                        .for_("5m")
                        .labels(MonitorTmpTkeAlertPolicyAlertRuleRuleLabelArgs.builder()
                            .name("severity")
                            .value("warning")
                            .build())
                        .build())
                    .notification(MonitorTmpTkeAlertPolicyAlertRuleNotificationArgs.builder()
                        .type("amp")
                        .enabled(true)
                        .alertManager(MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManagerArgs.builder()
                            .url("xxx")
                            .build())
                        .build())
                    .build())
                .build(), CustomResourceOptions.builder()
                    .dependsOn(fooMonitorTmpTkeClusterAgent)
                    .build());
    
        }
    }
    
    configuration:
      defaultInstanceType:
        type: string
        default: SA1.MEDIUM2
      availabilityZoneFirst:
        type: string
        default: ap-guangzhou-3
      availabilityZoneSecond:
        type: string
        default: ap-guangzhou-4
      exampleClusterCidr:
        type: string
        default: 10.31.0.0/16
      # create monitor
      zone:
        type: string
        default: ap-guangzhou
      clusterType:
        type: string
        default: tke
    resources:
      sg:
        type: tencentcloud:SecurityGroup
      sgRule:
        type: tencentcloud:SecurityGroupLiteRule
        properties:
          securityGroupId: ${sg.securityGroupId}
          ingresses:
            - ACCEPT#10.0.0.0/16#ALL#ALL
            - ACCEPT#172.16.0.0/22#ALL#ALL
            - DROP#0.0.0.0/0#ALL#ALL
          egresses:
            - ACCEPT#172.16.0.0/22#ALL#ALL
      example:
        type: tencentcloud:KubernetesCluster
        properties:
          vpcId: ${firstVpcId}
          clusterCidr: ${exampleClusterCidr}
          clusterMaxPodNum: 32
          clusterName: tf_example_cluster
          clusterDesc: example for tke cluster
          clusterMaxServiceNum: 32
          clusterInternet: false
          clusterInternetSecurityGroup: ${sgId}
          clusterVersion: 1.22.5
          clusterDeployType: MANAGED_CLUSTER
          workerConfigs:
            - count: 1
              availabilityZone: ${availabilityZoneFirst}
              instanceType: ${defaultInstanceType}
              systemDiskType: CLOUD_SSD
              systemDiskSize: 60
              internetChargeType: TRAFFIC_POSTPAID_BY_HOUR
              internetMaxBandwidthOut: 100
              publicIpAssigned: true
              subnetId: ${firstSubnetId}
              imgId: ${imageId}
              dataDisks:
                - diskType: CLOUD_PREMIUM
                  diskSize: 50
              enhancedSecurityService: false
              enhancedMonitorService: false
              userData: dGVzdA==
              password: ZZXXccvv1212
            - count: 1
              availabilityZone: ${availabilityZoneSecond}
              instanceType: ${defaultInstanceType}
              systemDiskType: CLOUD_SSD
              systemDiskSize: 60
              internetChargeType: TRAFFIC_POSTPAID_BY_HOUR
              internetMaxBandwidthOut: 100
              publicIpAssigned: true
              subnetId: ${secondSubnetId}
              dataDisks:
                - diskType: CLOUD_PREMIUM
                  diskSize: 50
              enhancedSecurityService: false
              enhancedMonitorService: false
              userData: dGVzdA==
              camRoleName: CVM_QcsRole
              password: ZZXXccvv1212
          labels:
            test1: test1
            test2: test2
      fooMonitorTmpInstance:
        type: tencentcloud:MonitorTmpInstance
        properties:
          instanceName: tf-tmp-instance
          vpcId: ${firstVpcId}
          subnetId: ${firstSubnetId}
          dataRetentionTime: 30
          zone: ${availabilityZoneSecond}
          tags:
            createdBy: terraform
      # tmp tke bind
      fooMonitorTmpTkeClusterAgent:
        type: tencentcloud:MonitorTmpTkeClusterAgent
        properties:
          instanceId: ${fooMonitorTmpInstance.monitorTmpInstanceId}
          agents:
            region: ${zone}
            clusterType: ${clusterType}
            clusterId: ${example.kubernetesClusterId}
            enableExternal: false
      # create record rule
      basic:
        type: tencentcloud:MonitorTmpTkeAlertPolicy
        properties:
          instanceId: ${fooMonitorTmpInstance.monitorTmpInstanceId}
          alertRule:
            name: alert_rule-test
            rules:
              - name: rules-test
                rule: (count(kube_node_status_allocatable_cpu_cores) by (cluster) -1)   / count(kube_node_status_allocatable_cpu_cores) by (cluster)
                template: The CPU requested by the Pod in the cluster {{ $labels.cluster }} is overloaded, and the current CPU application ratio is {{ $value | humanizePercentage }}
                for: 5m
                labels:
                  - name: severity
                    value: warning
            notification:
              type: amp
              enabled: true
              alertManager:
                url: xxx
        options:
          dependsOn:
            - ${fooMonitorTmpTkeClusterAgent}
    variables:
      firstVpcId: ${vpcOne.instanceLists[0].vpcId}
      firstSubnetId: ${vpcOne.instanceLists[0].subnetId}
      secondVpcId: ${vpcTwo.instanceLists[0].vpcId}
      secondSubnetId: ${vpcTwo.instanceLists[0].subnetId}
      sgId: ${sg.securityGroupId}
      imageId: ${default.imageId}
      vpcOne:
        fn::invoke:
          function: tencentcloud:getVpcSubnets
          arguments:
            isDefault: true
            availabilityZone: ${availabilityZoneFirst}
      vpcTwo:
        fn::invoke:
          function: tencentcloud:getVpcSubnets
          arguments:
            isDefault: true
            availabilityZone: ${availabilityZoneSecond}
      default:
        fn::invoke:
          function: tencentcloud:getImages
          arguments:
            imageTypes:
              - PUBLIC_IMAGE
            imageNameRegex: Final
    

    Create MonitorTmpTkeAlertPolicy Resource

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

    Constructor syntax

    new MonitorTmpTkeAlertPolicy(name: string, args: MonitorTmpTkeAlertPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def MonitorTmpTkeAlertPolicy(resource_name: str,
                                 args: MonitorTmpTkeAlertPolicyArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def MonitorTmpTkeAlertPolicy(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 alert_rule: Optional[MonitorTmpTkeAlertPolicyAlertRuleArgs] = None,
                                 instance_id: Optional[str] = None,
                                 monitor_tmp_tke_alert_policy_id: Optional[str] = None)
    func NewMonitorTmpTkeAlertPolicy(ctx *Context, name string, args MonitorTmpTkeAlertPolicyArgs, opts ...ResourceOption) (*MonitorTmpTkeAlertPolicy, error)
    public MonitorTmpTkeAlertPolicy(string name, MonitorTmpTkeAlertPolicyArgs args, CustomResourceOptions? opts = null)
    public MonitorTmpTkeAlertPolicy(String name, MonitorTmpTkeAlertPolicyArgs args)
    public MonitorTmpTkeAlertPolicy(String name, MonitorTmpTkeAlertPolicyArgs args, CustomResourceOptions options)
    
    type: tencentcloud:MonitorTmpTkeAlertPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

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

    MonitorTmpTkeAlertPolicy 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 MonitorTmpTkeAlertPolicy resource accepts the following input properties:

    AlertRule MonitorTmpTkeAlertPolicyAlertRule
    Alarm notification channels.
    InstanceId string
    Instance Id.
    MonitorTmpTkeAlertPolicyId string
    ID of the resource.
    AlertRule MonitorTmpTkeAlertPolicyAlertRuleArgs
    Alarm notification channels.
    InstanceId string
    Instance Id.
    MonitorTmpTkeAlertPolicyId string
    ID of the resource.
    alertRule MonitorTmpTkeAlertPolicyAlertRule
    Alarm notification channels.
    instanceId String
    Instance Id.
    monitorTmpTkeAlertPolicyId String
    ID of the resource.
    alertRule MonitorTmpTkeAlertPolicyAlertRule
    Alarm notification channels.
    instanceId string
    Instance Id.
    monitorTmpTkeAlertPolicyId string
    ID of the resource.
    alert_rule MonitorTmpTkeAlertPolicyAlertRuleArgs
    Alarm notification channels.
    instance_id str
    Instance Id.
    monitor_tmp_tke_alert_policy_id str
    ID of the resource.
    alertRule Property Map
    Alarm notification channels.
    instanceId String
    Instance Id.
    monitorTmpTkeAlertPolicyId String
    ID of the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the MonitorTmpTkeAlertPolicy 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 MonitorTmpTkeAlertPolicy Resource

    Get an existing MonitorTmpTkeAlertPolicy 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?: MonitorTmpTkeAlertPolicyState, opts?: CustomResourceOptions): MonitorTmpTkeAlertPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            alert_rule: Optional[MonitorTmpTkeAlertPolicyAlertRuleArgs] = None,
            instance_id: Optional[str] = None,
            monitor_tmp_tke_alert_policy_id: Optional[str] = None) -> MonitorTmpTkeAlertPolicy
    func GetMonitorTmpTkeAlertPolicy(ctx *Context, name string, id IDInput, state *MonitorTmpTkeAlertPolicyState, opts ...ResourceOption) (*MonitorTmpTkeAlertPolicy, error)
    public static MonitorTmpTkeAlertPolicy Get(string name, Input<string> id, MonitorTmpTkeAlertPolicyState? state, CustomResourceOptions? opts = null)
    public static MonitorTmpTkeAlertPolicy get(String name, Output<String> id, MonitorTmpTkeAlertPolicyState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:MonitorTmpTkeAlertPolicy    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    AlertRule MonitorTmpTkeAlertPolicyAlertRule
    Alarm notification channels.
    InstanceId string
    Instance Id.
    MonitorTmpTkeAlertPolicyId string
    ID of the resource.
    AlertRule MonitorTmpTkeAlertPolicyAlertRuleArgs
    Alarm notification channels.
    InstanceId string
    Instance Id.
    MonitorTmpTkeAlertPolicyId string
    ID of the resource.
    alertRule MonitorTmpTkeAlertPolicyAlertRule
    Alarm notification channels.
    instanceId String
    Instance Id.
    monitorTmpTkeAlertPolicyId String
    ID of the resource.
    alertRule MonitorTmpTkeAlertPolicyAlertRule
    Alarm notification channels.
    instanceId string
    Instance Id.
    monitorTmpTkeAlertPolicyId string
    ID of the resource.
    alert_rule MonitorTmpTkeAlertPolicyAlertRuleArgs
    Alarm notification channels.
    instance_id str
    Instance Id.
    monitor_tmp_tke_alert_policy_id str
    ID of the resource.
    alertRule Property Map
    Alarm notification channels.
    instanceId String
    Instance Id.
    monitorTmpTkeAlertPolicyId String
    ID of the resource.

    Supporting Types

    MonitorTmpTkeAlertPolicyAlertRule, MonitorTmpTkeAlertPolicyAlertRuleArgs

    Name string
    Rule name.
    Rules List<MonitorTmpTkeAlertPolicyAlertRuleRule>
    A list of rules.
    ClusterId string
    If the alarm policy is derived from the CRD resource definition of the user cluster, the ClusterId is the cluster ID to which it belongs.
    Id string
    Alarm policy ID. Note: This field may return null, indicating that a valid value could not be retrieved.
    Notification MonitorTmpTkeAlertPolicyAlertRuleNotification
    Alarm channels, which may be returned using null in the template.
    TemplateId string
    If the alarm is sent from a template, the TemplateId is the template id.
    UpdatedAt string
    Last modified time.
    Name string
    Rule name.
    Rules []MonitorTmpTkeAlertPolicyAlertRuleRule
    A list of rules.
    ClusterId string
    If the alarm policy is derived from the CRD resource definition of the user cluster, the ClusterId is the cluster ID to which it belongs.
    Id string
    Alarm policy ID. Note: This field may return null, indicating that a valid value could not be retrieved.
    Notification MonitorTmpTkeAlertPolicyAlertRuleNotification
    Alarm channels, which may be returned using null in the template.
    TemplateId string
    If the alarm is sent from a template, the TemplateId is the template id.
    UpdatedAt string
    Last modified time.
    name String
    Rule name.
    rules List<MonitorTmpTkeAlertPolicyAlertRuleRule>
    A list of rules.
    clusterId String
    If the alarm policy is derived from the CRD resource definition of the user cluster, the ClusterId is the cluster ID to which it belongs.
    id String
    Alarm policy ID. Note: This field may return null, indicating that a valid value could not be retrieved.
    notification MonitorTmpTkeAlertPolicyAlertRuleNotification
    Alarm channels, which may be returned using null in the template.
    templateId String
    If the alarm is sent from a template, the TemplateId is the template id.
    updatedAt String
    Last modified time.
    name string
    Rule name.
    rules MonitorTmpTkeAlertPolicyAlertRuleRule[]
    A list of rules.
    clusterId string
    If the alarm policy is derived from the CRD resource definition of the user cluster, the ClusterId is the cluster ID to which it belongs.
    id string
    Alarm policy ID. Note: This field may return null, indicating that a valid value could not be retrieved.
    notification MonitorTmpTkeAlertPolicyAlertRuleNotification
    Alarm channels, which may be returned using null in the template.
    templateId string
    If the alarm is sent from a template, the TemplateId is the template id.
    updatedAt string
    Last modified time.
    name str
    Rule name.
    rules Sequence[MonitorTmpTkeAlertPolicyAlertRuleRule]
    A list of rules.
    cluster_id str
    If the alarm policy is derived from the CRD resource definition of the user cluster, the ClusterId is the cluster ID to which it belongs.
    id str
    Alarm policy ID. Note: This field may return null, indicating that a valid value could not be retrieved.
    notification MonitorTmpTkeAlertPolicyAlertRuleNotification
    Alarm channels, which may be returned using null in the template.
    template_id str
    If the alarm is sent from a template, the TemplateId is the template id.
    updated_at str
    Last modified time.
    name String
    Rule name.
    rules List<Property Map>
    A list of rules.
    clusterId String
    If the alarm policy is derived from the CRD resource definition of the user cluster, the ClusterId is the cluster ID to which it belongs.
    id String
    Alarm policy ID. Note: This field may return null, indicating that a valid value could not be retrieved.
    notification Property Map
    Alarm channels, which may be returned using null in the template.
    templateId String
    If the alarm is sent from a template, the TemplateId is the template id.
    updatedAt String
    Last modified time.

    MonitorTmpTkeAlertPolicyAlertRuleNotification, MonitorTmpTkeAlertPolicyAlertRuleNotificationArgs

    Enabled bool
    Whether it is enabled.
    Type string
    The channel type, which defaults to amp, supports the following amp, webhook, alertmanager.
    AlertManager MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManager
    If Type is alertmanager, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved..
    NotifyWays List<string>
    Alarm notification method. At present, there are SMS, EMAIL, CALL, WECHAT methods.
    PhoneArriveNotice bool
    Telephone alerts reach notifications.
    PhoneCircleInterval double
    Effective end timeTelephone alarm wheel interval. Units: Seconds.
    PhoneCircleTimes double
    PhoneCircleTimes.
    PhoneInnerInterval double
    Telephone alarm wheel intervals. Units: Seconds.
    PhoneNotifyOrders List<double>
    Telephone alarm sequence.
    ReceiverGroups List<string>
    Alert Receiving Group (User Group).
    RepeatInterval string
    Convergence time.
    TimeRangeEnd string
    Effective end time.
    TimeRangeStart string
    The time from which it takes effect.
    WebHook string
    If Type is webhook, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved.
    Enabled bool
    Whether it is enabled.
    Type string
    The channel type, which defaults to amp, supports the following amp, webhook, alertmanager.
    AlertManager MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManager
    If Type is alertmanager, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved..
    NotifyWays []string
    Alarm notification method. At present, there are SMS, EMAIL, CALL, WECHAT methods.
    PhoneArriveNotice bool
    Telephone alerts reach notifications.
    PhoneCircleInterval float64
    Effective end timeTelephone alarm wheel interval. Units: Seconds.
    PhoneCircleTimes float64
    PhoneCircleTimes.
    PhoneInnerInterval float64
    Telephone alarm wheel intervals. Units: Seconds.
    PhoneNotifyOrders []float64
    Telephone alarm sequence.
    ReceiverGroups []string
    Alert Receiving Group (User Group).
    RepeatInterval string
    Convergence time.
    TimeRangeEnd string
    Effective end time.
    TimeRangeStart string
    The time from which it takes effect.
    WebHook string
    If Type is webhook, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved.
    enabled Boolean
    Whether it is enabled.
    type String
    The channel type, which defaults to amp, supports the following amp, webhook, alertmanager.
    alertManager MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManager
    If Type is alertmanager, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved..
    notifyWays List<String>
    Alarm notification method. At present, there are SMS, EMAIL, CALL, WECHAT methods.
    phoneArriveNotice Boolean
    Telephone alerts reach notifications.
    phoneCircleInterval Double
    Effective end timeTelephone alarm wheel interval. Units: Seconds.
    phoneCircleTimes Double
    PhoneCircleTimes.
    phoneInnerInterval Double
    Telephone alarm wheel intervals. Units: Seconds.
    phoneNotifyOrders List<Double>
    Telephone alarm sequence.
    receiverGroups List<String>
    Alert Receiving Group (User Group).
    repeatInterval String
    Convergence time.
    timeRangeEnd String
    Effective end time.
    timeRangeStart String
    The time from which it takes effect.
    webHook String
    If Type is webhook, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved.
    enabled boolean
    Whether it is enabled.
    type string
    The channel type, which defaults to amp, supports the following amp, webhook, alertmanager.
    alertManager MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManager
    If Type is alertmanager, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved..
    notifyWays string[]
    Alarm notification method. At present, there are SMS, EMAIL, CALL, WECHAT methods.
    phoneArriveNotice boolean
    Telephone alerts reach notifications.
    phoneCircleInterval number
    Effective end timeTelephone alarm wheel interval. Units: Seconds.
    phoneCircleTimes number
    PhoneCircleTimes.
    phoneInnerInterval number
    Telephone alarm wheel intervals. Units: Seconds.
    phoneNotifyOrders number[]
    Telephone alarm sequence.
    receiverGroups string[]
    Alert Receiving Group (User Group).
    repeatInterval string
    Convergence time.
    timeRangeEnd string
    Effective end time.
    timeRangeStart string
    The time from which it takes effect.
    webHook string
    If Type is webhook, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved.
    enabled bool
    Whether it is enabled.
    type str
    The channel type, which defaults to amp, supports the following amp, webhook, alertmanager.
    alert_manager MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManager
    If Type is alertmanager, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved..
    notify_ways Sequence[str]
    Alarm notification method. At present, there are SMS, EMAIL, CALL, WECHAT methods.
    phone_arrive_notice bool
    Telephone alerts reach notifications.
    phone_circle_interval float
    Effective end timeTelephone alarm wheel interval. Units: Seconds.
    phone_circle_times float
    PhoneCircleTimes.
    phone_inner_interval float
    Telephone alarm wheel intervals. Units: Seconds.
    phone_notify_orders Sequence[float]
    Telephone alarm sequence.
    receiver_groups Sequence[str]
    Alert Receiving Group (User Group).
    repeat_interval str
    Convergence time.
    time_range_end str
    Effective end time.
    time_range_start str
    The time from which it takes effect.
    web_hook str
    If Type is webhook, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved.
    enabled Boolean
    Whether it is enabled.
    type String
    The channel type, which defaults to amp, supports the following amp, webhook, alertmanager.
    alertManager Property Map
    If Type is alertmanager, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved..
    notifyWays List<String>
    Alarm notification method. At present, there are SMS, EMAIL, CALL, WECHAT methods.
    phoneArriveNotice Boolean
    Telephone alerts reach notifications.
    phoneCircleInterval Number
    Effective end timeTelephone alarm wheel interval. Units: Seconds.
    phoneCircleTimes Number
    PhoneCircleTimes.
    phoneInnerInterval Number
    Telephone alarm wheel intervals. Units: Seconds.
    phoneNotifyOrders List<Number>
    Telephone alarm sequence.
    receiverGroups List<String>
    Alert Receiving Group (User Group).
    repeatInterval String
    Convergence time.
    timeRangeEnd String
    Effective end time.
    timeRangeStart String
    The time from which it takes effect.
    webHook String
    If Type is webhook, the field is required. Note: This field may return null, indicating that a valid value could not be retrieved.

    MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManager, MonitorTmpTkeAlertPolicyAlertRuleNotificationAlertManagerArgs

    Url string
    Alertmanager url.
    ClusterId string
    The ID of the cluster where the alertmanager is deployed. Note: This field may return null, indicating that a valid value could not be retrieved.
    ClusterType string
    Alertmanager is deployed in the cluster type. Note: This field may return null, indicating that a valid value could not be retrieved.
    Url string
    Alertmanager url.
    ClusterId string
    The ID of the cluster where the alertmanager is deployed. Note: This field may return null, indicating that a valid value could not be retrieved.
    ClusterType string
    Alertmanager is deployed in the cluster type. Note: This field may return null, indicating that a valid value could not be retrieved.
    url String
    Alertmanager url.
    clusterId String
    The ID of the cluster where the alertmanager is deployed. Note: This field may return null, indicating that a valid value could not be retrieved.
    clusterType String
    Alertmanager is deployed in the cluster type. Note: This field may return null, indicating that a valid value could not be retrieved.
    url string
    Alertmanager url.
    clusterId string
    The ID of the cluster where the alertmanager is deployed. Note: This field may return null, indicating that a valid value could not be retrieved.
    clusterType string
    Alertmanager is deployed in the cluster type. Note: This field may return null, indicating that a valid value could not be retrieved.
    url str
    Alertmanager url.
    cluster_id str
    The ID of the cluster where the alertmanager is deployed. Note: This field may return null, indicating that a valid value could not be retrieved.
    cluster_type str
    Alertmanager is deployed in the cluster type. Note: This field may return null, indicating that a valid value could not be retrieved.
    url String
    Alertmanager url.
    clusterId String
    The ID of the cluster where the alertmanager is deployed. Note: This field may return null, indicating that a valid value could not be retrieved.
    clusterType String
    Alertmanager is deployed in the cluster type. Note: This field may return null, indicating that a valid value could not be retrieved.

    MonitorTmpTkeAlertPolicyAlertRuleRule, MonitorTmpTkeAlertPolicyAlertRuleRuleArgs

    For string
    Time of duration.
    Labels List<MonitorTmpTkeAlertPolicyAlertRuleRuleLabel>
    Extra labels.
    Name string
    Rule name.
    Rule string
    Prometheus statement.
    Template string
    Alert sending template.
    Annotations List<MonitorTmpTkeAlertPolicyAlertRuleRuleAnnotation>
    Refer to annotations in prometheus rule.
    Describe string
    A description of the rule.
    RuleState double
    Alarm rule status.
    For string
    Time of duration.
    Labels []MonitorTmpTkeAlertPolicyAlertRuleRuleLabel
    Extra labels.
    Name string
    Rule name.
    Rule string
    Prometheus statement.
    Template string
    Alert sending template.
    Annotations []MonitorTmpTkeAlertPolicyAlertRuleRuleAnnotation
    Refer to annotations in prometheus rule.
    Describe string
    A description of the rule.
    RuleState float64
    Alarm rule status.
    for_ String
    Time of duration.
    labels List<MonitorTmpTkeAlertPolicyAlertRuleRuleLabel>
    Extra labels.
    name String
    Rule name.
    rule String
    Prometheus statement.
    template String
    Alert sending template.
    annotations List<MonitorTmpTkeAlertPolicyAlertRuleRuleAnnotation>
    Refer to annotations in prometheus rule.
    describe String
    A description of the rule.
    ruleState Double
    Alarm rule status.
    for string
    Time of duration.
    labels MonitorTmpTkeAlertPolicyAlertRuleRuleLabel[]
    Extra labels.
    name string
    Rule name.
    rule string
    Prometheus statement.
    template string
    Alert sending template.
    annotations MonitorTmpTkeAlertPolicyAlertRuleRuleAnnotation[]
    Refer to annotations in prometheus rule.
    describe string
    A description of the rule.
    ruleState number
    Alarm rule status.
    for_ str
    Time of duration.
    labels Sequence[MonitorTmpTkeAlertPolicyAlertRuleRuleLabel]
    Extra labels.
    name str
    Rule name.
    rule str
    Prometheus statement.
    template str
    Alert sending template.
    annotations Sequence[MonitorTmpTkeAlertPolicyAlertRuleRuleAnnotation]
    Refer to annotations in prometheus rule.
    describe str
    A description of the rule.
    rule_state float
    Alarm rule status.
    for String
    Time of duration.
    labels List<Property Map>
    Extra labels.
    name String
    Rule name.
    rule String
    Prometheus statement.
    template String
    Alert sending template.
    annotations List<Property Map>
    Refer to annotations in prometheus rule.
    describe String
    A description of the rule.
    ruleState Number
    Alarm rule status.

    MonitorTmpTkeAlertPolicyAlertRuleRuleAnnotation, MonitorTmpTkeAlertPolicyAlertRuleRuleAnnotationArgs

    Name string
    Name of map.
    Value string
    Value of map.
    Name string
    Name of map.
    Value string
    Value of map.
    name String
    Name of map.
    value String
    Value of map.
    name string
    Name of map.
    value string
    Value of map.
    name str
    Name of map.
    value str
    Value of map.
    name String
    Name of map.
    value String
    Value of map.

    MonitorTmpTkeAlertPolicyAlertRuleRuleLabel, MonitorTmpTkeAlertPolicyAlertRuleRuleLabelArgs

    Name string
    Name of map.
    Value string
    Value of map.
    Name string
    Name of map.
    Value string
    Value of map.
    name String
    Name of map.
    value String
    Value of map.
    name string
    Name of map.
    value string
    Value of map.
    name str
    Name of map.
    value str
    Value of map.
    name String
    Name of map.
    value String
    Value of map.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack