1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. arms
  5. EnvCustomJob
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

alicloud.arms.EnvCustomJob

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

    Provides a ARMS Env Custom Job resource. Custom jobs in the arms environment.

    For information about ARMS Env Custom Job and how to use it, see What is Env Custom Job.

    NOTE: Available since v1.212.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const _default = new random.index.Integer("default", {
        max: 99999,
        min: 10000,
    });
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const vpc = new alicloud.vpc.Network("vpc", {
        description: name,
        cidrBlock: "172.16.0.0/12",
        vpcName: name,
    });
    const env_ecs = new alicloud.arms.Environment("env-ecs", {
        environmentType: "ECS",
        environmentName: `terraform-example-${_default.result}`,
        bindResourceId: vpc.id,
        environmentSubType: "ECS",
    });
    const defaultEnvCustomJob = new alicloud.arms.EnvCustomJob("default", {
        status: "run",
        environmentId: env_ecs.id,
        envCustomJobName: name,
        configYaml: `scrape_configs:
    - job_name: job-demo1
      honor_timestamps: false
      honor_labels: false
      scrape_interval: 30s
      scheme: http
      metrics_path: /metric
      static_configs:
      - targets:
        - 127.0.0.1:9090
    `,
        aliyunLang: "en",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    default = random.index.Integer("default",
        max=99999,
        min=10000)
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    vpc = alicloud.vpc.Network("vpc",
        description=name,
        cidr_block="172.16.0.0/12",
        vpc_name=name)
    env_ecs = alicloud.arms.Environment("env-ecs",
        environment_type="ECS",
        environment_name=f"terraform-example-{default['result']}",
        bind_resource_id=vpc.id,
        environment_sub_type="ECS")
    default_env_custom_job = alicloud.arms.EnvCustomJob("default",
        status="run",
        environment_id=env_ecs.id,
        env_custom_job_name=name,
        config_yaml="""scrape_configs:
    - job_name: job-demo1
      honor_timestamps: false
      honor_labels: false
      scrape_interval: 30s
      scheme: http
      metrics_path: /metric
      static_configs:
      - targets:
        - 127.0.0.1:9090
    """,
        aliyun_lang="en")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/arms"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"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 {
    		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Max: 99999,
    			Min: 10000,
    		})
    		if err != nil {
    			return err
    		}
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		vpc, err := vpc.NewNetwork(ctx, "vpc", &vpc.NetworkArgs{
    			Description: pulumi.String(name),
    			CidrBlock:   pulumi.String("172.16.0.0/12"),
    			VpcName:     pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = arms.NewEnvironment(ctx, "env-ecs", &arms.EnvironmentArgs{
    			EnvironmentType:    pulumi.String("ECS"),
    			EnvironmentName:    pulumi.String(fmt.Sprintf("terraform-example-%v", _default.Result)),
    			BindResourceId:     vpc.ID(),
    			EnvironmentSubType: pulumi.String("ECS"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = arms.NewEnvCustomJob(ctx, "default", &arms.EnvCustomJobArgs{
    			Status:           pulumi.String("run"),
    			EnvironmentId:    env_ecs.ID(),
    			EnvCustomJobName: pulumi.String(name),
    			ConfigYaml: pulumi.String(`scrape_configs:
    - job_name: job-demo1
      honor_timestamps: false
      honor_labels: false
      scrape_interval: 30s
      scheme: http
      metrics_path: /metric
      static_configs:
      - targets:
        - 127.0.0.1:9090
    `),
    			AliyunLang: pulumi.String("en"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Random.Index.Integer("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var vpc = new AliCloud.Vpc.Network("vpc", new()
        {
            Description = name,
            CidrBlock = "172.16.0.0/12",
            VpcName = name,
        });
    
        var env_ecs = new AliCloud.Arms.Environment("env-ecs", new()
        {
            EnvironmentType = "ECS",
            EnvironmentName = $"terraform-example-{@default.Result}",
            BindResourceId = vpc.Id,
            EnvironmentSubType = "ECS",
        });
    
        var defaultEnvCustomJob = new AliCloud.Arms.EnvCustomJob("default", new()
        {
            Status = "run",
            EnvironmentId = env_ecs.Id,
            EnvCustomJobName = name,
            ConfigYaml = @"scrape_configs:
    - job_name: job-demo1
      honor_timestamps: false
      honor_labels: false
      scrape_interval: 30s
      scheme: http
      metrics_path: /metric
      static_configs:
      - targets:
        - 127.0.0.1:9090
    ",
            AliyunLang = "en",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.arms.Environment;
    import com.pulumi.alicloud.arms.EnvironmentArgs;
    import com.pulumi.alicloud.arms.EnvCustomJob;
    import com.pulumi.alicloud.arms.EnvCustomJobArgs;
    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();
            var default_ = new Integer("default", IntegerArgs.builder()        
                .max(99999)
                .min(10000)
                .build());
    
            final var name = config.get("name").orElse("terraform-example");
            var vpc = new Network("vpc", NetworkArgs.builder()        
                .description(name)
                .cidrBlock("172.16.0.0/12")
                .vpcName(name)
                .build());
    
            var env_ecs = new Environment("env-ecs", EnvironmentArgs.builder()        
                .environmentType("ECS")
                .environmentName(String.format("terraform-example-%s", default_.result()))
                .bindResourceId(vpc.id())
                .environmentSubType("ECS")
                .build());
    
            var defaultEnvCustomJob = new EnvCustomJob("defaultEnvCustomJob", EnvCustomJobArgs.builder()        
                .status("run")
                .environmentId(env_ecs.id())
                .envCustomJobName(name)
                .configYaml("""
    scrape_configs:
    - job_name: job-demo1
      honor_timestamps: false
      honor_labels: false
      scrape_interval: 30s
      scheme: http
      metrics_path: /metric
      static_configs:
      - targets:
        - 127.0.0.1:9090
                """)
                .aliyunLang("en")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: random:integer
        properties:
          max: 99999
          min: 10000
      vpc:
        type: alicloud:vpc:Network
        properties:
          description: ${name}
          cidrBlock: 172.16.0.0/12
          vpcName: ${name}
      env-ecs:
        type: alicloud:arms:Environment
        properties:
          environmentType: ECS
          environmentName: terraform-example-${default.result}
          bindResourceId: ${vpc.id}
          environmentSubType: ECS
      defaultEnvCustomJob:
        type: alicloud:arms:EnvCustomJob
        name: default
        properties:
          status: run
          environmentId: ${["env-ecs"].id}
          envCustomJobName: ${name}
          configYaml: |
            scrape_configs:
            - job_name: job-demo1
              honor_timestamps: false
              honor_labels: false
              scrape_interval: 30s
              scheme: http
              metrics_path: /metric
              static_configs:
              - targets:
                - 127.0.0.1:9090        
          aliyunLang: en
    

    Create EnvCustomJob Resource

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

    Constructor syntax

    new EnvCustomJob(name: string, args: EnvCustomJobArgs, opts?: CustomResourceOptions);
    @overload
    def EnvCustomJob(resource_name: str,
                     args: EnvCustomJobArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def EnvCustomJob(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     config_yaml: Optional[str] = None,
                     env_custom_job_name: Optional[str] = None,
                     environment_id: Optional[str] = None,
                     aliyun_lang: Optional[str] = None,
                     status: Optional[str] = None)
    func NewEnvCustomJob(ctx *Context, name string, args EnvCustomJobArgs, opts ...ResourceOption) (*EnvCustomJob, error)
    public EnvCustomJob(string name, EnvCustomJobArgs args, CustomResourceOptions? opts = null)
    public EnvCustomJob(String name, EnvCustomJobArgs args)
    public EnvCustomJob(String name, EnvCustomJobArgs args, CustomResourceOptions options)
    
    type: alicloud:arms:EnvCustomJob
    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 EnvCustomJobArgs
    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 EnvCustomJobArgs
    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 EnvCustomJobArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EnvCustomJobArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EnvCustomJobArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var envCustomJobResource = new AliCloud.Arms.EnvCustomJob("envCustomJobResource", new()
    {
        ConfigYaml = "string",
        EnvCustomJobName = "string",
        EnvironmentId = "string",
        AliyunLang = "string",
        Status = "string",
    });
    
    example, err := arms.NewEnvCustomJob(ctx, "envCustomJobResource", &arms.EnvCustomJobArgs{
    	ConfigYaml:       pulumi.String("string"),
    	EnvCustomJobName: pulumi.String("string"),
    	EnvironmentId:    pulumi.String("string"),
    	AliyunLang:       pulumi.String("string"),
    	Status:           pulumi.String("string"),
    })
    
    var envCustomJobResource = new EnvCustomJob("envCustomJobResource", EnvCustomJobArgs.builder()        
        .configYaml("string")
        .envCustomJobName("string")
        .environmentId("string")
        .aliyunLang("string")
        .status("string")
        .build());
    
    env_custom_job_resource = alicloud.arms.EnvCustomJob("envCustomJobResource",
        config_yaml="string",
        env_custom_job_name="string",
        environment_id="string",
        aliyun_lang="string",
        status="string")
    
    const envCustomJobResource = new alicloud.arms.EnvCustomJob("envCustomJobResource", {
        configYaml: "string",
        envCustomJobName: "string",
        environmentId: "string",
        aliyunLang: "string",
        status: "string",
    });
    
    type: alicloud:arms:EnvCustomJob
    properties:
        aliyunLang: string
        configYaml: string
        envCustomJobName: string
        environmentId: string
        status: string
    

    EnvCustomJob Resource Properties

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

    Inputs

    The EnvCustomJob resource accepts the following input properties:

    ConfigYaml string
    Yaml configuration string.
    EnvCustomJobName string
    Custom job name.
    EnvironmentId string
    Environment id.
    AliyunLang string
    The locale. The default is Chinese zh | en.
    Status string
    Status: run, stop.
    ConfigYaml string
    Yaml configuration string.
    EnvCustomJobName string
    Custom job name.
    EnvironmentId string
    Environment id.
    AliyunLang string
    The locale. The default is Chinese zh | en.
    Status string
    Status: run, stop.
    configYaml String
    Yaml configuration string.
    envCustomJobName String
    Custom job name.
    environmentId String
    Environment id.
    aliyunLang String
    The locale. The default is Chinese zh | en.
    status String
    Status: run, stop.
    configYaml string
    Yaml configuration string.
    envCustomJobName string
    Custom job name.
    environmentId string
    Environment id.
    aliyunLang string
    The locale. The default is Chinese zh | en.
    status string
    Status: run, stop.
    config_yaml str
    Yaml configuration string.
    env_custom_job_name str
    Custom job name.
    environment_id str
    Environment id.
    aliyun_lang str
    The locale. The default is Chinese zh | en.
    status str
    Status: run, stop.
    configYaml String
    Yaml configuration string.
    envCustomJobName String
    Custom job name.
    environmentId String
    Environment id.
    aliyunLang String
    The locale. The default is Chinese zh | en.
    status String
    Status: run, stop.

    Outputs

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

    Get an existing EnvCustomJob 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?: EnvCustomJobState, opts?: CustomResourceOptions): EnvCustomJob
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            aliyun_lang: Optional[str] = None,
            config_yaml: Optional[str] = None,
            env_custom_job_name: Optional[str] = None,
            environment_id: Optional[str] = None,
            status: Optional[str] = None) -> EnvCustomJob
    func GetEnvCustomJob(ctx *Context, name string, id IDInput, state *EnvCustomJobState, opts ...ResourceOption) (*EnvCustomJob, error)
    public static EnvCustomJob Get(string name, Input<string> id, EnvCustomJobState? state, CustomResourceOptions? opts = null)
    public static EnvCustomJob get(String name, Output<String> id, EnvCustomJobState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    AliyunLang string
    The locale. The default is Chinese zh | en.
    ConfigYaml string
    Yaml configuration string.
    EnvCustomJobName string
    Custom job name.
    EnvironmentId string
    Environment id.
    Status string
    Status: run, stop.
    AliyunLang string
    The locale. The default is Chinese zh | en.
    ConfigYaml string
    Yaml configuration string.
    EnvCustomJobName string
    Custom job name.
    EnvironmentId string
    Environment id.
    Status string
    Status: run, stop.
    aliyunLang String
    The locale. The default is Chinese zh | en.
    configYaml String
    Yaml configuration string.
    envCustomJobName String
    Custom job name.
    environmentId String
    Environment id.
    status String
    Status: run, stop.
    aliyunLang string
    The locale. The default is Chinese zh | en.
    configYaml string
    Yaml configuration string.
    envCustomJobName string
    Custom job name.
    environmentId string
    Environment id.
    status string
    Status: run, stop.
    aliyun_lang str
    The locale. The default is Chinese zh | en.
    config_yaml str
    Yaml configuration string.
    env_custom_job_name str
    Custom job name.
    environment_id str
    Environment id.
    status str
    Status: run, stop.
    aliyunLang String
    The locale. The default is Chinese zh | en.
    configYaml String
    Yaml configuration string.
    envCustomJobName String
    Custom job name.
    environmentId String
    Environment id.
    status String
    Status: run, stop.

    Import

    ARMS Env Custom Job can be imported using the id, e.g.

    $ pulumi import alicloud:arms/envCustomJob:EnvCustomJob example <environment_id>:<env_custom_job_name>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi