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

tencentcloud.MonitorTmpScrapeJob

Explore with Pulumi AI

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

    Provides a resource to create a monitor tmpScrapeJob

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const config = new pulumi.Config();
    const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-4";
    const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
    const subnet = new tencentcloud.Subnet("subnet", {
        vpcId: vpc.vpcId,
        availabilityZone: availabilityZone,
        cidrBlock: "10.0.1.0/24",
    });
    const fooMonitorTmpInstance = new tencentcloud.MonitorTmpInstance("fooMonitorTmpInstance", {
        instanceName: "tf-tmp-instance",
        vpcId: vpc.vpcId,
        subnetId: subnet.subnetId,
        dataRetentionTime: 30,
        zone: availabilityZone,
        tags: {
            createdBy: "terraform",
        },
    });
    const fooMonitorTmpCvmAgent = new tencentcloud.MonitorTmpCvmAgent("fooMonitorTmpCvmAgent", {instanceId: fooMonitorTmpInstance.monitorTmpInstanceId});
    const fooMonitorTmpScrapeJob = new tencentcloud.MonitorTmpScrapeJob("fooMonitorTmpScrapeJob", {
        instanceId: fooMonitorTmpInstance.monitorTmpInstanceId,
        agentId: fooMonitorTmpCvmAgent.agentId,
        config: `job_name: demo-config
    honor_timestamps: true
    metrics_path: /metrics
    scheme: https
    `,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    config = pulumi.Config()
    availability_zone = config.get("availabilityZone")
    if availability_zone is None:
        availability_zone = "ap-guangzhou-4"
    vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
    subnet = tencentcloud.Subnet("subnet",
        vpc_id=vpc.vpc_id,
        availability_zone=availability_zone,
        cidr_block="10.0.1.0/24")
    foo_monitor_tmp_instance = tencentcloud.MonitorTmpInstance("fooMonitorTmpInstance",
        instance_name="tf-tmp-instance",
        vpc_id=vpc.vpc_id,
        subnet_id=subnet.subnet_id,
        data_retention_time=30,
        zone=availability_zone,
        tags={
            "createdBy": "terraform",
        })
    foo_monitor_tmp_cvm_agent = tencentcloud.MonitorTmpCvmAgent("fooMonitorTmpCvmAgent", instance_id=foo_monitor_tmp_instance.monitor_tmp_instance_id)
    foo_monitor_tmp_scrape_job = tencentcloud.MonitorTmpScrapeJob("fooMonitorTmpScrapeJob",
        instance_id=foo_monitor_tmp_instance.monitor_tmp_instance_id,
        agent_id=foo_monitor_tmp_cvm_agent.agent_id,
        config="""job_name: demo-config
    honor_timestamps: true
    metrics_path: /metrics
    scheme: https
    """)
    
    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, "")
    		availabilityZone := "ap-guangzhou-4"
    		if param := cfg.Get("availabilityZone"); param != "" {
    			availabilityZone = param
    		}
    		vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
    			CidrBlock: pulumi.String("10.0.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
    			VpcId:            vpc.VpcId,
    			AvailabilityZone: pulumi.String(availabilityZone),
    			CidrBlock:        pulumi.String("10.0.1.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		fooMonitorTmpInstance, err := tencentcloud.NewMonitorTmpInstance(ctx, "fooMonitorTmpInstance", &tencentcloud.MonitorTmpInstanceArgs{
    			InstanceName:      pulumi.String("tf-tmp-instance"),
    			VpcId:             vpc.VpcId,
    			SubnetId:          subnet.SubnetId,
    			DataRetentionTime: pulumi.Float64(30),
    			Zone:              pulumi.String(availabilityZone),
    			Tags: pulumi.StringMap{
    				"createdBy": pulumi.String("terraform"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fooMonitorTmpCvmAgent, err := tencentcloud.NewMonitorTmpCvmAgent(ctx, "fooMonitorTmpCvmAgent", &tencentcloud.MonitorTmpCvmAgentArgs{
    			InstanceId: fooMonitorTmpInstance.MonitorTmpInstanceId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewMonitorTmpScrapeJob(ctx, "fooMonitorTmpScrapeJob", &tencentcloud.MonitorTmpScrapeJobArgs{
    			InstanceId: fooMonitorTmpInstance.MonitorTmpInstanceId,
    			AgentId:    fooMonitorTmpCvmAgent.AgentId,
    			Config:     pulumi.String("job_name: demo-config\nhonor_timestamps: true\nmetrics_path: /metrics\nscheme: https\n"),
    		})
    		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 availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-4";
        var vpc = new Tencentcloud.Vpc("vpc", new()
        {
            CidrBlock = "10.0.0.0/16",
        });
    
        var subnet = new Tencentcloud.Subnet("subnet", new()
        {
            VpcId = vpc.VpcId,
            AvailabilityZone = availabilityZone,
            CidrBlock = "10.0.1.0/24",
        });
    
        var fooMonitorTmpInstance = new Tencentcloud.MonitorTmpInstance("fooMonitorTmpInstance", new()
        {
            InstanceName = "tf-tmp-instance",
            VpcId = vpc.VpcId,
            SubnetId = subnet.SubnetId,
            DataRetentionTime = 30,
            Zone = availabilityZone,
            Tags = 
            {
                { "createdBy", "terraform" },
            },
        });
    
        var fooMonitorTmpCvmAgent = new Tencentcloud.MonitorTmpCvmAgent("fooMonitorTmpCvmAgent", new()
        {
            InstanceId = fooMonitorTmpInstance.MonitorTmpInstanceId,
        });
    
        var fooMonitorTmpScrapeJob = new Tencentcloud.MonitorTmpScrapeJob("fooMonitorTmpScrapeJob", new()
        {
            InstanceId = fooMonitorTmpInstance.MonitorTmpInstanceId,
            AgentId = fooMonitorTmpCvmAgent.AgentId,
            Config = @"job_name: demo-config
    honor_timestamps: true
    metrics_path: /metrics
    scheme: https
    ",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.Vpc;
    import com.pulumi.tencentcloud.VpcArgs;
    import com.pulumi.tencentcloud.Subnet;
    import com.pulumi.tencentcloud.SubnetArgs;
    import com.pulumi.tencentcloud.MonitorTmpInstance;
    import com.pulumi.tencentcloud.MonitorTmpInstanceArgs;
    import com.pulumi.tencentcloud.MonitorTmpCvmAgent;
    import com.pulumi.tencentcloud.MonitorTmpCvmAgentArgs;
    import com.pulumi.tencentcloud.MonitorTmpScrapeJob;
    import com.pulumi.tencentcloud.MonitorTmpScrapeJobArgs;
    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 availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-4");
            var vpc = new Vpc("vpc", VpcArgs.builder()
                .cidrBlock("10.0.0.0/16")
                .build());
    
            var subnet = new Subnet("subnet", SubnetArgs.builder()
                .vpcId(vpc.vpcId())
                .availabilityZone(availabilityZone)
                .cidrBlock("10.0.1.0/24")
                .build());
    
            var fooMonitorTmpInstance = new MonitorTmpInstance("fooMonitorTmpInstance", MonitorTmpInstanceArgs.builder()
                .instanceName("tf-tmp-instance")
                .vpcId(vpc.vpcId())
                .subnetId(subnet.subnetId())
                .dataRetentionTime(30)
                .zone(availabilityZone)
                .tags(Map.of("createdBy", "terraform"))
                .build());
    
            var fooMonitorTmpCvmAgent = new MonitorTmpCvmAgent("fooMonitorTmpCvmAgent", MonitorTmpCvmAgentArgs.builder()
                .instanceId(fooMonitorTmpInstance.monitorTmpInstanceId())
                .build());
    
            var fooMonitorTmpScrapeJob = new MonitorTmpScrapeJob("fooMonitorTmpScrapeJob", MonitorTmpScrapeJobArgs.builder()
                .instanceId(fooMonitorTmpInstance.monitorTmpInstanceId())
                .agentId(fooMonitorTmpCvmAgent.agentId())
                .config("""
    job_name: demo-config
    honor_timestamps: true
    metrics_path: /metrics
    scheme: https
                """)
                .build());
    
        }
    }
    
    configuration:
      availabilityZone:
        type: string
        default: ap-guangzhou-4
    resources:
      vpc:
        type: tencentcloud:Vpc
        properties:
          cidrBlock: 10.0.0.0/16
      subnet:
        type: tencentcloud:Subnet
        properties:
          vpcId: ${vpc.vpcId}
          availabilityZone: ${availabilityZone}
          cidrBlock: 10.0.1.0/24
      fooMonitorTmpInstance:
        type: tencentcloud:MonitorTmpInstance
        properties:
          instanceName: tf-tmp-instance
          vpcId: ${vpc.vpcId}
          subnetId: ${subnet.subnetId}
          dataRetentionTime: 30
          zone: ${availabilityZone}
          tags:
            createdBy: terraform
      fooMonitorTmpCvmAgent:
        type: tencentcloud:MonitorTmpCvmAgent
        properties:
          instanceId: ${fooMonitorTmpInstance.monitorTmpInstanceId}
      fooMonitorTmpScrapeJob:
        type: tencentcloud:MonitorTmpScrapeJob
        properties:
          instanceId: ${fooMonitorTmpInstance.monitorTmpInstanceId}
          agentId: ${fooMonitorTmpCvmAgent.agentId}
          config: |
            job_name: demo-config
            honor_timestamps: true
            metrics_path: /metrics
            scheme: https        
    

    Create MonitorTmpScrapeJob Resource

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

    Constructor syntax

    new MonitorTmpScrapeJob(name: string, args: MonitorTmpScrapeJobArgs, opts?: CustomResourceOptions);
    @overload
    def MonitorTmpScrapeJob(resource_name: str,
                            args: MonitorTmpScrapeJobArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def MonitorTmpScrapeJob(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            agent_id: Optional[str] = None,
                            instance_id: Optional[str] = None,
                            config: Optional[str] = None,
                            monitor_tmp_scrape_job_id: Optional[str] = None)
    func NewMonitorTmpScrapeJob(ctx *Context, name string, args MonitorTmpScrapeJobArgs, opts ...ResourceOption) (*MonitorTmpScrapeJob, error)
    public MonitorTmpScrapeJob(string name, MonitorTmpScrapeJobArgs args, CustomResourceOptions? opts = null)
    public MonitorTmpScrapeJob(String name, MonitorTmpScrapeJobArgs args)
    public MonitorTmpScrapeJob(String name, MonitorTmpScrapeJobArgs args, CustomResourceOptions options)
    
    type: tencentcloud:MonitorTmpScrapeJob
    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 MonitorTmpScrapeJobArgs
    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 MonitorTmpScrapeJobArgs
    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 MonitorTmpScrapeJobArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MonitorTmpScrapeJobArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MonitorTmpScrapeJobArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    AgentId string
    Agent id.
    InstanceId string
    Instance id.
    Config string
    Job content.
    MonitorTmpScrapeJobId string
    ID of the resource.
    AgentId string
    Agent id.
    InstanceId string
    Instance id.
    Config string
    Job content.
    MonitorTmpScrapeJobId string
    ID of the resource.
    agentId String
    Agent id.
    instanceId String
    Instance id.
    config String
    Job content.
    monitorTmpScrapeJobId String
    ID of the resource.
    agentId string
    Agent id.
    instanceId string
    Instance id.
    config string
    Job content.
    monitorTmpScrapeJobId string
    ID of the resource.
    agent_id str
    Agent id.
    instance_id str
    Instance id.
    config str
    Job content.
    monitor_tmp_scrape_job_id str
    ID of the resource.
    agentId String
    Agent id.
    instanceId String
    Instance id.
    config String
    Job content.
    monitorTmpScrapeJobId String
    ID of the resource.

    Outputs

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

    Get an existing MonitorTmpScrapeJob 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?: MonitorTmpScrapeJobState, opts?: CustomResourceOptions): MonitorTmpScrapeJob
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            agent_id: Optional[str] = None,
            config: Optional[str] = None,
            instance_id: Optional[str] = None,
            monitor_tmp_scrape_job_id: Optional[str] = None) -> MonitorTmpScrapeJob
    func GetMonitorTmpScrapeJob(ctx *Context, name string, id IDInput, state *MonitorTmpScrapeJobState, opts ...ResourceOption) (*MonitorTmpScrapeJob, error)
    public static MonitorTmpScrapeJob Get(string name, Input<string> id, MonitorTmpScrapeJobState? state, CustomResourceOptions? opts = null)
    public static MonitorTmpScrapeJob get(String name, Output<String> id, MonitorTmpScrapeJobState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:MonitorTmpScrapeJob    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:
    AgentId string
    Agent id.
    Config string
    Job content.
    InstanceId string
    Instance id.
    MonitorTmpScrapeJobId string
    ID of the resource.
    AgentId string
    Agent id.
    Config string
    Job content.
    InstanceId string
    Instance id.
    MonitorTmpScrapeJobId string
    ID of the resource.
    agentId String
    Agent id.
    config String
    Job content.
    instanceId String
    Instance id.
    monitorTmpScrapeJobId String
    ID of the resource.
    agentId string
    Agent id.
    config string
    Job content.
    instanceId string
    Instance id.
    monitorTmpScrapeJobId string
    ID of the resource.
    agent_id str
    Agent id.
    config str
    Job content.
    instance_id str
    Instance id.
    monitor_tmp_scrape_job_id str
    ID of the resource.
    agentId String
    Agent id.
    config String
    Job content.
    instanceId String
    Instance id.
    monitorTmpScrapeJobId String
    ID of the resource.

    Import

    monitor tmpScrapeJob can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/monitorTmpScrapeJob:MonitorTmpScrapeJob tmpScrapeJob tmpScrapeJob_id
    

    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.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack