1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. ApmPrometheusRule
tencentcloud 1.82.50 published on Tuesday, Dec 30, 2025 by tencentcloudstack
tencentcloud logo
tencentcloud 1.82.50 published on Tuesday, Dec 30, 2025 by tencentcloudstack

    Provides a resource to create a APM prometheus rule

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = new tencentcloud.ApmPrometheusRule("example", {
        instanceId: "apm-lhqHyRBuA",
        name: "tf-example",
        serviceName: "java-market-service",
        metricMatchType: 0,
        metricNameRule: "task.duration",
        status: 1,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.ApmPrometheusRule("example",
        instance_id="apm-lhqHyRBuA",
        name="tf-example",
        service_name="java-market-service",
        metric_match_type=0,
        metric_name_rule="task.duration",
        status=1)
    
    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.NewApmPrometheusRule(ctx, "example", &tencentcloud.ApmPrometheusRuleArgs{
    			InstanceId:      pulumi.String("apm-lhqHyRBuA"),
    			Name:            pulumi.String("tf-example"),
    			ServiceName:     pulumi.String("java-market-service"),
    			MetricMatchType: pulumi.Float64(0),
    			MetricNameRule:  pulumi.String("task.duration"),
    			Status:          pulumi.Float64(1),
    		})
    		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 example = new Tencentcloud.ApmPrometheusRule("example", new()
        {
            InstanceId = "apm-lhqHyRBuA",
            Name = "tf-example",
            ServiceName = "java-market-service",
            MetricMatchType = 0,
            MetricNameRule = "task.duration",
            Status = 1,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.ApmPrometheusRule;
    import com.pulumi.tencentcloud.ApmPrometheusRuleArgs;
    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 ApmPrometheusRule("example", ApmPrometheusRuleArgs.builder()
                .instanceId("apm-lhqHyRBuA")
                .name("tf-example")
                .serviceName("java-market-service")
                .metricMatchType(0.0)
                .metricNameRule("task.duration")
                .status(1.0)
                .build());
    
        }
    }
    
    resources:
      example:
        type: tencentcloud:ApmPrometheusRule
        properties:
          instanceId: apm-lhqHyRBuA
          name: tf-example
          serviceName: java-market-service
          metricMatchType: 0
          metricNameRule: task.duration
          status: 1
    

    Create ApmPrometheusRule Resource

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

    Constructor syntax

    new ApmPrometheusRule(name: string, args: ApmPrometheusRuleArgs, opts?: CustomResourceOptions);
    @overload
    def ApmPrometheusRule(resource_name: str,
                          args: ApmPrometheusRuleArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApmPrometheusRule(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          instance_id: Optional[str] = None,
                          metric_match_type: Optional[float] = None,
                          metric_name_rule: Optional[str] = None,
                          service_name: Optional[str] = None,
                          apm_prometheus_rule_id: Optional[str] = None,
                          name: Optional[str] = None,
                          status: Optional[float] = None)
    func NewApmPrometheusRule(ctx *Context, name string, args ApmPrometheusRuleArgs, opts ...ResourceOption) (*ApmPrometheusRule, error)
    public ApmPrometheusRule(string name, ApmPrometheusRuleArgs args, CustomResourceOptions? opts = null)
    public ApmPrometheusRule(String name, ApmPrometheusRuleArgs args)
    public ApmPrometheusRule(String name, ApmPrometheusRuleArgs args, CustomResourceOptions options)
    
    type: tencentcloud:ApmPrometheusRule
    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 ApmPrometheusRuleArgs
    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 ApmPrometheusRuleArgs
    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 ApmPrometheusRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApmPrometheusRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApmPrometheusRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    InstanceId string
    Business system ID.
    MetricMatchType double
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    MetricNameRule string
    Specifies the rule for customer-defined metric names with cache hit.
    ServiceName string
    Applications where the rule takes effect. input an empty string for all applications.
    ApmPrometheusRuleId string
    ID of the resource.
    Name string
    Metric match rule name.
    Status double
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    InstanceId string
    Business system ID.
    MetricMatchType float64
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    MetricNameRule string
    Specifies the rule for customer-defined metric names with cache hit.
    ServiceName string
    Applications where the rule takes effect. input an empty string for all applications.
    ApmPrometheusRuleId string
    ID of the resource.
    Name string
    Metric match rule name.
    Status float64
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    instanceId String
    Business system ID.
    metricMatchType Double
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metricNameRule String
    Specifies the rule for customer-defined metric names with cache hit.
    serviceName String
    Applications where the rule takes effect. input an empty string for all applications.
    apmPrometheusRuleId String
    ID of the resource.
    name String
    Metric match rule name.
    status Double
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    instanceId string
    Business system ID.
    metricMatchType number
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metricNameRule string
    Specifies the rule for customer-defined metric names with cache hit.
    serviceName string
    Applications where the rule takes effect. input an empty string for all applications.
    apmPrometheusRuleId string
    ID of the resource.
    name string
    Metric match rule name.
    status number
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    instance_id str
    Business system ID.
    metric_match_type float
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metric_name_rule str
    Specifies the rule for customer-defined metric names with cache hit.
    service_name str
    Applications where the rule takes effect. input an empty string for all applications.
    apm_prometheus_rule_id str
    ID of the resource.
    name str
    Metric match rule name.
    status float
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    instanceId String
    Business system ID.
    metricMatchType Number
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metricNameRule String
    Specifies the rule for customer-defined metric names with cache hit.
    serviceName String
    Applications where the rule takes effect. input an empty string for all applications.
    apmPrometheusRuleId String
    ID of the resource.
    name String
    Metric match rule name.
    status Number
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId double
    ID of the indicator matching rule.
    Id string
    The provider-assigned unique ID for this managed resource.
    RuleId float64
    ID of the indicator matching rule.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId Double
    ID of the indicator matching rule.
    id string
    The provider-assigned unique ID for this managed resource.
    ruleId number
    ID of the indicator matching rule.
    id str
    The provider-assigned unique ID for this managed resource.
    rule_id float
    ID of the indicator matching rule.
    id String
    The provider-assigned unique ID for this managed resource.
    ruleId Number
    ID of the indicator matching rule.

    Look up Existing ApmPrometheusRule Resource

    Get an existing ApmPrometheusRule 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?: ApmPrometheusRuleState, opts?: CustomResourceOptions): ApmPrometheusRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            apm_prometheus_rule_id: Optional[str] = None,
            instance_id: Optional[str] = None,
            metric_match_type: Optional[float] = None,
            metric_name_rule: Optional[str] = None,
            name: Optional[str] = None,
            rule_id: Optional[float] = None,
            service_name: Optional[str] = None,
            status: Optional[float] = None) -> ApmPrometheusRule
    func GetApmPrometheusRule(ctx *Context, name string, id IDInput, state *ApmPrometheusRuleState, opts ...ResourceOption) (*ApmPrometheusRule, error)
    public static ApmPrometheusRule Get(string name, Input<string> id, ApmPrometheusRuleState? state, CustomResourceOptions? opts = null)
    public static ApmPrometheusRule get(String name, Output<String> id, ApmPrometheusRuleState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:ApmPrometheusRule    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:
    ApmPrometheusRuleId string
    ID of the resource.
    InstanceId string
    Business system ID.
    MetricMatchType double
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    MetricNameRule string
    Specifies the rule for customer-defined metric names with cache hit.
    Name string
    Metric match rule name.
    RuleId double
    ID of the indicator matching rule.
    ServiceName string
    Applications where the rule takes effect. input an empty string for all applications.
    Status double
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    ApmPrometheusRuleId string
    ID of the resource.
    InstanceId string
    Business system ID.
    MetricMatchType float64
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    MetricNameRule string
    Specifies the rule for customer-defined metric names with cache hit.
    Name string
    Metric match rule name.
    RuleId float64
    ID of the indicator matching rule.
    ServiceName string
    Applications where the rule takes effect. input an empty string for all applications.
    Status float64
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    apmPrometheusRuleId String
    ID of the resource.
    instanceId String
    Business system ID.
    metricMatchType Double
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metricNameRule String
    Specifies the rule for customer-defined metric names with cache hit.
    name String
    Metric match rule name.
    ruleId Double
    ID of the indicator matching rule.
    serviceName String
    Applications where the rule takes effect. input an empty string for all applications.
    status Double
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    apmPrometheusRuleId string
    ID of the resource.
    instanceId string
    Business system ID.
    metricMatchType number
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metricNameRule string
    Specifies the rule for customer-defined metric names with cache hit.
    name string
    Metric match rule name.
    ruleId number
    ID of the indicator matching rule.
    serviceName string
    Applications where the rule takes effect. input an empty string for all applications.
    status number
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    apm_prometheus_rule_id str
    ID of the resource.
    instance_id str
    Business system ID.
    metric_match_type float
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metric_name_rule str
    Specifies the rule for customer-defined metric names with cache hit.
    name str
    Metric match rule name.
    rule_id float
    ID of the indicator matching rule.
    service_name str
    Applications where the rule takes effect. input an empty string for all applications.
    status float
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.
    apmPrometheusRuleId String
    ID of the resource.
    instanceId String
    Business system ID.
    metricMatchType Number
    Match type: 0 - precision match, 1 - prefix match, 2 - suffix match.
    metricNameRule String
    Specifies the rule for customer-defined metric names with cache hit.
    name String
    Metric match rule name.
    ruleId Number
    ID of the indicator matching rule.
    serviceName String
    Applications where the rule takes effect. input an empty string for all applications.
    status Number
    Rule status. 1 - enabled, 2 - disabled. Default value: 1.

    Import

    APM prometheus rule can be imported using the instanceId#ruleId, e.g.

    $ pulumi import tencentcloud:index/apmPrometheusRule:ApmPrometheusRule example apm-lhqHyRBuA#140
    

    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.
    tencentcloud logo
    tencentcloud 1.82.50 published on Tuesday, Dec 30, 2025 by tencentcloudstack
      Meet Neo: Your AI Platform Teammate