1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. ApmSampleConfig
tencentcloud 1.82.45 published on Tuesday, Dec 16, 2025 by tencentcloudstack
tencentcloud logo
tencentcloud 1.82.45 published on Tuesday, Dec 16, 2025 by tencentcloudstack

    Provides a resource to create a APM sample config

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = new tencentcloud.ApmInstance("example", {
        name: "tf-example",
        description: "desc.",
        traceDuration: 7,
        spanDailyCounters: 0,
        tags: {
            createdBy: "Terraform",
        },
    });
    const exampleApmSampleConfig = new tencentcloud.ApmSampleConfig("example", {
        instanceId: example.apmInstanceId,
        sampleName: "tf-example",
        sampleRate: 90,
        serviceName: "java-order-serive",
        operationType: 0,
        tags: [{
            key: "createdBy",
            value: "Terraform",
        }],
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.ApmInstance("example",
        name="tf-example",
        description="desc.",
        trace_duration=7,
        span_daily_counters=0,
        tags={
            "createdBy": "Terraform",
        })
    example_apm_sample_config = tencentcloud.ApmSampleConfig("example",
        instance_id=example.apm_instance_id,
        sample_name="tf-example",
        sample_rate=90,
        service_name="java-order-serive",
        operation_type=0,
        tags=[{
            "key": "createdBy",
            "value": "Terraform",
        }])
    
    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 {
    		example, err := tencentcloud.NewApmInstance(ctx, "example", &tencentcloud.ApmInstanceArgs{
    			Name:              pulumi.String("tf-example"),
    			Description:       pulumi.String("desc."),
    			TraceDuration:     pulumi.Float64(7),
    			SpanDailyCounters: pulumi.Float64(0),
    			Tags: pulumi.StringMap{
    				"createdBy": pulumi.String("Terraform"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewApmSampleConfig(ctx, "example", &tencentcloud.ApmSampleConfigArgs{
    			InstanceId:    example.ApmInstanceId,
    			SampleName:    pulumi.String("tf-example"),
    			SampleRate:    pulumi.Float64(90),
    			ServiceName:   pulumi.String("java-order-serive"),
    			OperationType: pulumi.Float64(0),
    			Tags: tencentcloud.ApmSampleConfigTagArray{
    				&tencentcloud.ApmSampleConfigTagArgs{
    					Key:   pulumi.String("createdBy"),
    					Value: pulumi.String("Terraform"),
    				},
    			},
    		})
    		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.ApmInstance("example", new()
        {
            Name = "tf-example",
            Description = "desc.",
            TraceDuration = 7,
            SpanDailyCounters = 0,
            Tags = 
            {
                { "createdBy", "Terraform" },
            },
        });
    
        var exampleApmSampleConfig = new Tencentcloud.ApmSampleConfig("example", new()
        {
            InstanceId = example.ApmInstanceId,
            SampleName = "tf-example",
            SampleRate = 90,
            ServiceName = "java-order-serive",
            OperationType = 0,
            Tags = new[]
            {
                new Tencentcloud.Inputs.ApmSampleConfigTagArgs
                {
                    Key = "createdBy",
                    Value = "Terraform",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.ApmInstance;
    import com.pulumi.tencentcloud.ApmInstanceArgs;
    import com.pulumi.tencentcloud.ApmSampleConfig;
    import com.pulumi.tencentcloud.ApmSampleConfigArgs;
    import com.pulumi.tencentcloud.inputs.ApmSampleConfigTagArgs;
    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 ApmInstance("example", ApmInstanceArgs.builder()
                .name("tf-example")
                .description("desc.")
                .traceDuration(7.0)
                .spanDailyCounters(0.0)
                .tags(Map.of("createdBy", "Terraform"))
                .build());
    
            var exampleApmSampleConfig = new ApmSampleConfig("exampleApmSampleConfig", ApmSampleConfigArgs.builder()
                .instanceId(example.apmInstanceId())
                .sampleName("tf-example")
                .sampleRate(90.0)
                .serviceName("java-order-serive")
                .operationType(0.0)
                .tags(ApmSampleConfigTagArgs.builder()
                    .key("createdBy")
                    .value("Terraform")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: tencentcloud:ApmInstance
        properties:
          name: tf-example
          description: desc.
          traceDuration: 7
          spanDailyCounters: 0
          tags:
            createdBy: Terraform
      exampleApmSampleConfig:
        type: tencentcloud:ApmSampleConfig
        name: example
        properties:
          instanceId: ${example.apmInstanceId}
          sampleName: tf-example
          sampleRate: 90
          serviceName: java-order-serive
          operationType: 0
          tags:
            - key: createdBy
              value: Terraform
    

    Create ApmSampleConfig Resource

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

    Constructor syntax

    new ApmSampleConfig(name: string, args: ApmSampleConfigArgs, opts?: CustomResourceOptions);
    @overload
    def ApmSampleConfig(resource_name: str,
                        args: ApmSampleConfigArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApmSampleConfig(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        instance_id: Optional[str] = None,
                        sample_name: Optional[str] = None,
                        sample_rate: Optional[float] = None,
                        service_name: Optional[str] = None,
                        apm_sample_config_id: Optional[str] = None,
                        operation_name: Optional[str] = None,
                        operation_type: Optional[float] = None,
                        tags: Optional[Sequence[ApmSampleConfigTagArgs]] = None)
    func NewApmSampleConfig(ctx *Context, name string, args ApmSampleConfigArgs, opts ...ResourceOption) (*ApmSampleConfig, error)
    public ApmSampleConfig(string name, ApmSampleConfigArgs args, CustomResourceOptions? opts = null)
    public ApmSampleConfig(String name, ApmSampleConfigArgs args)
    public ApmSampleConfig(String name, ApmSampleConfigArgs args, CustomResourceOptions options)
    
    type: tencentcloud:ApmSampleConfig
    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 ApmSampleConfigArgs
    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 ApmSampleConfigArgs
    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 ApmSampleConfigArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApmSampleConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApmSampleConfigArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    InstanceId string
    Business system ID.
    SampleName string
    Sampling rule name.
    SampleRate double
    Sampling rate.
    ServiceName string
    Application name.
    ApmSampleConfigId string
    ID of the resource.
    OperationName string
    API name.
    OperationType double
    0: exact match (default); 1: prefix match; 2: suffix match.
    Tags List<ApmSampleConfigTag>
    Sampling tags.
    InstanceId string
    Business system ID.
    SampleName string
    Sampling rule name.
    SampleRate float64
    Sampling rate.
    ServiceName string
    Application name.
    ApmSampleConfigId string
    ID of the resource.
    OperationName string
    API name.
    OperationType float64
    0: exact match (default); 1: prefix match; 2: suffix match.
    Tags []ApmSampleConfigTagArgs
    Sampling tags.
    instanceId String
    Business system ID.
    sampleName String
    Sampling rule name.
    sampleRate Double
    Sampling rate.
    serviceName String
    Application name.
    apmSampleConfigId String
    ID of the resource.
    operationName String
    API name.
    operationType Double
    0: exact match (default); 1: prefix match; 2: suffix match.
    tags List<ApmSampleConfigTag>
    Sampling tags.
    instanceId string
    Business system ID.
    sampleName string
    Sampling rule name.
    sampleRate number
    Sampling rate.
    serviceName string
    Application name.
    apmSampleConfigId string
    ID of the resource.
    operationName string
    API name.
    operationType number
    0: exact match (default); 1: prefix match; 2: suffix match.
    tags ApmSampleConfigTag[]
    Sampling tags.
    instance_id str
    Business system ID.
    sample_name str
    Sampling rule name.
    sample_rate float
    Sampling rate.
    service_name str
    Application name.
    apm_sample_config_id str
    ID of the resource.
    operation_name str
    API name.
    operation_type float
    0: exact match (default); 1: prefix match; 2: suffix match.
    tags Sequence[ApmSampleConfigTagArgs]
    Sampling tags.
    instanceId String
    Business system ID.
    sampleName String
    Sampling rule name.
    sampleRate Number
    Sampling rate.
    serviceName String
    Application name.
    apmSampleConfigId String
    ID of the resource.
    operationName String
    API name.
    operationType Number
    0: exact match (default); 1: prefix match; 2: suffix match.
    tags List<Property Map>
    Sampling tags.

    Outputs

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

    Get an existing ApmSampleConfig 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?: ApmSampleConfigState, opts?: CustomResourceOptions): ApmSampleConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            apm_sample_config_id: Optional[str] = None,
            instance_id: Optional[str] = None,
            operation_name: Optional[str] = None,
            operation_type: Optional[float] = None,
            sample_name: Optional[str] = None,
            sample_rate: Optional[float] = None,
            service_name: Optional[str] = None,
            tags: Optional[Sequence[ApmSampleConfigTagArgs]] = None) -> ApmSampleConfig
    func GetApmSampleConfig(ctx *Context, name string, id IDInput, state *ApmSampleConfigState, opts ...ResourceOption) (*ApmSampleConfig, error)
    public static ApmSampleConfig Get(string name, Input<string> id, ApmSampleConfigState? state, CustomResourceOptions? opts = null)
    public static ApmSampleConfig get(String name, Output<String> id, ApmSampleConfigState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:ApmSampleConfig    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:
    ApmSampleConfigId string
    ID of the resource.
    InstanceId string
    Business system ID.
    OperationName string
    API name.
    OperationType double
    0: exact match (default); 1: prefix match; 2: suffix match.
    SampleName string
    Sampling rule name.
    SampleRate double
    Sampling rate.
    ServiceName string
    Application name.
    Tags List<ApmSampleConfigTag>
    Sampling tags.
    ApmSampleConfigId string
    ID of the resource.
    InstanceId string
    Business system ID.
    OperationName string
    API name.
    OperationType float64
    0: exact match (default); 1: prefix match; 2: suffix match.
    SampleName string
    Sampling rule name.
    SampleRate float64
    Sampling rate.
    ServiceName string
    Application name.
    Tags []ApmSampleConfigTagArgs
    Sampling tags.
    apmSampleConfigId String
    ID of the resource.
    instanceId String
    Business system ID.
    operationName String
    API name.
    operationType Double
    0: exact match (default); 1: prefix match; 2: suffix match.
    sampleName String
    Sampling rule name.
    sampleRate Double
    Sampling rate.
    serviceName String
    Application name.
    tags List<ApmSampleConfigTag>
    Sampling tags.
    apmSampleConfigId string
    ID of the resource.
    instanceId string
    Business system ID.
    operationName string
    API name.
    operationType number
    0: exact match (default); 1: prefix match; 2: suffix match.
    sampleName string
    Sampling rule name.
    sampleRate number
    Sampling rate.
    serviceName string
    Application name.
    tags ApmSampleConfigTag[]
    Sampling tags.
    apm_sample_config_id str
    ID of the resource.
    instance_id str
    Business system ID.
    operation_name str
    API name.
    operation_type float
    0: exact match (default); 1: prefix match; 2: suffix match.
    sample_name str
    Sampling rule name.
    sample_rate float
    Sampling rate.
    service_name str
    Application name.
    tags Sequence[ApmSampleConfigTagArgs]
    Sampling tags.
    apmSampleConfigId String
    ID of the resource.
    instanceId String
    Business system ID.
    operationName String
    API name.
    operationType Number
    0: exact match (default); 1: prefix match; 2: suffix match.
    sampleName String
    Sampling rule name.
    sampleRate Number
    Sampling rate.
    serviceName String
    Application name.
    tags List<Property Map>
    Sampling tags.

    Supporting Types

    ApmSampleConfigTag, ApmSampleConfigTagArgs

    Key string
    Key value definition.
    Value string
    Value definition.
    Key string
    Key value definition.
    Value string
    Value definition.
    key String
    Key value definition.
    value String
    Value definition.
    key string
    Key value definition.
    value string
    Value definition.
    key str
    Key value definition.
    value str
    Value definition.
    key String
    Key value definition.
    value String
    Value definition.

    Import

    APM sample config can be imported using the instanceId#sampleName, e.g.

    $ pulumi import tencentcloud:index/apmSampleConfig:ApmSampleConfig example apm-jPr5iQL77#tf-example
    

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