Alibaba Cloud v3.85.0 published on Tuesday, Sep 9, 2025 by Pulumi
alicloud.arms.getEnvCustomJobs
Explore with Pulumi AI
This data source provides the ARMS Env Custom Jobs of the current Alibaba Cloud user.
NOTE: Available since v1.258.0.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const defaultInteger = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const _default = alicloud.vpc.getNetworks({
nameRegex: "^default-NODELETING$",
});
const defaultEnvironment = new alicloud.arms.Environment("default", {
bindResourceId: _default.then(_default => _default.ids?.[0]),
environmentSubType: "ECS",
environmentType: "ECS",
environmentName: `${name}-${defaultInteger.result}`,
tags: {
Created: "TF",
For: "Environment",
},
});
const defaultEnvCustomJob = new alicloud.arms.EnvCustomJob("default", {
status: "run",
environmentId: defaultEnvironment.id,
envCustomJobName: `${name}-${defaultInteger.result}`,
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",
});
const ids = alicloud.arms.getEnvCustomJobsOutput({
environmentId: defaultEnvCustomJob.environmentId,
ids: [defaultEnvCustomJob.id],
});
export const armsEnvCustomJobsId0 = ids.apply(ids => ids.jobs?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default_integer = random.index.Integer("default",
min=10000,
max=99999)
default = alicloud.vpc.get_networks(name_regex="^default-NODELETING$")
default_environment = alicloud.arms.Environment("default",
bind_resource_id=default.ids[0],
environment_sub_type="ECS",
environment_type="ECS",
environment_name=f"{name}-{default_integer['result']}",
tags={
"Created": "TF",
"For": "Environment",
})
default_env_custom_job = alicloud.arms.EnvCustomJob("default",
status="run",
environment_id=default_environment.id,
env_custom_job_name=f"{name}-{default_integer['result']}",
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")
ids = alicloud.arms.get_env_custom_jobs_output(environment_id=default_env_custom_job.environment_id,
ids=[default_env_custom_job.id])
pulumi.export("armsEnvCustomJobsId0", ids.jobs[0].id)
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 {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
_default, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
NameRegex: pulumi.StringRef("^default-NODELETING$"),
}, nil)
if err != nil {
return err
}
defaultEnvironment, err := arms.NewEnvironment(ctx, "default", &arms.EnvironmentArgs{
BindResourceId: pulumi.String(_default.Ids[0]),
EnvironmentSubType: pulumi.String("ECS"),
EnvironmentType: pulumi.String("ECS"),
EnvironmentName: pulumi.Sprintf("%v-%v", name, defaultInteger.Result),
Tags: pulumi.StringMap{
"Created": pulumi.String("TF"),
"For": pulumi.String("Environment"),
},
})
if err != nil {
return err
}
defaultEnvCustomJob, err := arms.NewEnvCustomJob(ctx, "default", &arms.EnvCustomJobArgs{
Status: pulumi.String("run"),
EnvironmentId: defaultEnvironment.ID(),
EnvCustomJobName: pulumi.Sprintf("%v-%v", name, defaultInteger.Result),
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
}
ids := arms.GetEnvCustomJobsOutput(ctx, arms.GetEnvCustomJobsOutputArgs{
EnvironmentId: defaultEnvCustomJob.EnvironmentId,
Ids: pulumi.StringArray{
defaultEnvCustomJob.ID(),
},
}, nil)
ctx.Export("armsEnvCustomJobsId0", ids.ApplyT(func(ids arms.GetEnvCustomJobsResult) (*string, error) {
return &ids.Jobs[0].Id, nil
}).(pulumi.StringPtrOutput))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var defaultInteger = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var @default = AliCloud.Vpc.GetNetworks.Invoke(new()
{
NameRegex = "^default-NODELETING$",
});
var defaultEnvironment = new AliCloud.Arms.Environment("default", new()
{
BindResourceId = @default.Apply(@default => @default.Apply(getNetworksResult => getNetworksResult.Ids[0])),
EnvironmentSubType = "ECS",
EnvironmentType = "ECS",
EnvironmentName = $"{name}-{defaultInteger.Result}",
Tags =
{
{ "Created", "TF" },
{ "For", "Environment" },
},
});
var defaultEnvCustomJob = new AliCloud.Arms.EnvCustomJob("default", new()
{
Status = "run",
EnvironmentId = defaultEnvironment.Id,
EnvCustomJobName = $"{name}-{defaultInteger.Result}",
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",
});
var ids = AliCloud.Arms.GetEnvCustomJobs.Invoke(new()
{
EnvironmentId = defaultEnvCustomJob.EnvironmentId,
Ids = new[]
{
defaultEnvCustomJob.Id,
},
});
return new Dictionary<string, object?>
{
["armsEnvCustomJobsId0"] = ids.Apply(getEnvCustomJobsResult => getEnvCustomJobsResult.Jobs[0]?.Id),
};
});
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.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
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 com.pulumi.alicloud.arms.ArmsFunctions;
import com.pulumi.alicloud.arms.inputs.GetEnvCustomJobsArgs;
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 name = config.get("name").orElse("terraform-example");
var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
final var default = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.nameRegex("^default-NODELETING$")
.build());
var defaultEnvironment = new Environment("defaultEnvironment", EnvironmentArgs.builder()
.bindResourceId(default_.ids()[0])
.environmentSubType("ECS")
.environmentType("ECS")
.environmentName(String.format("%s-%s", name,defaultInteger.result()))
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "Environment")
))
.build());
var defaultEnvCustomJob = new EnvCustomJob("defaultEnvCustomJob", EnvCustomJobArgs.builder()
.status("run")
.environmentId(defaultEnvironment.id())
.envCustomJobName(String.format("%s-%s", name,defaultInteger.result()))
.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());
final var ids = ArmsFunctions.getEnvCustomJobs(GetEnvCustomJobsArgs.builder()
.environmentId(defaultEnvCustomJob.environmentId())
.ids(defaultEnvCustomJob.id())
.build());
ctx.export("armsEnvCustomJobsId0", ids.applyValue(_ids -> _ids.jobs()[0].id()));
}
}
configuration:
name:
type: string
default: terraform-example
resources:
defaultInteger:
type: random:Integer
name: default
properties:
min: 10000
max: 99999
defaultEnvironment:
type: alicloud:arms:Environment
name: default
properties:
bindResourceId: ${default.ids[0]}
environmentSubType: ECS
environmentType: ECS
environmentName: ${name}-${defaultInteger.result}
tags:
Created: TF
For: Environment
defaultEnvCustomJob:
type: alicloud:arms:EnvCustomJob
name: default
properties:
status: run
environmentId: ${defaultEnvironment.id}
envCustomJobName: ${name}-${defaultInteger.result}
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
variables:
default:
fn::invoke:
function: alicloud:vpc:getNetworks
arguments:
nameRegex: ^default-NODELETING$
ids:
fn::invoke:
function: alicloud:arms:getEnvCustomJobs
arguments:
environmentId: ${defaultEnvCustomJob.environmentId}
ids:
- ${defaultEnvCustomJob.id}
outputs:
armsEnvCustomJobsId0: ${ids.jobs[0].id}
Using getEnvCustomJobs
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getEnvCustomJobs(args: GetEnvCustomJobsArgs, opts?: InvokeOptions): Promise<GetEnvCustomJobsResult>
function getEnvCustomJobsOutput(args: GetEnvCustomJobsOutputArgs, opts?: InvokeOptions): Output<GetEnvCustomJobsResult>
def get_env_custom_jobs(environment_id: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetEnvCustomJobsResult
def get_env_custom_jobs_output(environment_id: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetEnvCustomJobsResult]
func GetEnvCustomJobs(ctx *Context, args *GetEnvCustomJobsArgs, opts ...InvokeOption) (*GetEnvCustomJobsResult, error)
func GetEnvCustomJobsOutput(ctx *Context, args *GetEnvCustomJobsOutputArgs, opts ...InvokeOption) GetEnvCustomJobsResultOutput
> Note: This function is named GetEnvCustomJobs
in the Go SDK.
public static class GetEnvCustomJobs
{
public static Task<GetEnvCustomJobsResult> InvokeAsync(GetEnvCustomJobsArgs args, InvokeOptions? opts = null)
public static Output<GetEnvCustomJobsResult> Invoke(GetEnvCustomJobsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEnvCustomJobsResult> getEnvCustomJobs(GetEnvCustomJobsArgs args, InvokeOptions options)
public static Output<GetEnvCustomJobsResult> getEnvCustomJobs(GetEnvCustomJobsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:arms/getEnvCustomJobs:getEnvCustomJobs
arguments:
# arguments dictionary
The following arguments are supported:
- Environment
Id string - The ID of the environment instance.
- Ids List<string>
- A list of ARMS Env Custom Job IDs.
- Name
Regex string - A regex string to filter results by ARMS Env Custom Job name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Environment
Id string - The ID of the environment instance.
- Ids []string
- A list of ARMS Env Custom Job IDs.
- Name
Regex string - A regex string to filter results by ARMS Env Custom Job name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- environment
Id String - The ID of the environment instance.
- ids List<String>
- A list of ARMS Env Custom Job IDs.
- name
Regex String - A regex string to filter results by ARMS Env Custom Job name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- environment
Id string - The ID of the environment instance.
- ids string[]
- A list of ARMS Env Custom Job IDs.
- name
Regex string - A regex string to filter results by ARMS Env Custom Job name.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- environment_
id str - The ID of the environment instance.
- ids Sequence[str]
- A list of ARMS Env Custom Job IDs.
- name_
regex str - A regex string to filter results by ARMS Env Custom Job name.
- output_
file str - File name where to save data source results (after running
pulumi preview
).
- environment
Id String - The ID of the environment instance.
- ids List<String>
- A list of ARMS Env Custom Job IDs.
- name
Regex String - A regex string to filter results by ARMS Env Custom Job name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getEnvCustomJobs Result
The following output properties are available:
- Environment
Id string - The ID of the environment instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Jobs
List<Pulumi.
Ali Cloud. Arms. Outputs. Get Env Custom Jobs Job> - A list of ARMS Env Custom Jobs. Each element contains the following attributes:
- Names List<string>
- A list of ARMS Env Custom Job names.
- Name
Regex string - Output
File string
- Environment
Id string - The ID of the environment instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Jobs
[]Get
Env Custom Jobs Job - A list of ARMS Env Custom Jobs. Each element contains the following attributes:
- Names []string
- A list of ARMS Env Custom Job names.
- Name
Regex string - Output
File string
- environment
Id String - The ID of the environment instance.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- jobs
List<Get
Env Custom Jobs Job> - A list of ARMS Env Custom Jobs. Each element contains the following attributes:
- names List<String>
- A list of ARMS Env Custom Job names.
- name
Regex String - output
File String
- environment
Id string - The ID of the environment instance.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- jobs
Get
Env Custom Jobs Job[] - A list of ARMS Env Custom Jobs. Each element contains the following attributes:
- names string[]
- A list of ARMS Env Custom Job names.
- name
Regex string - output
File string
- environment_
id str - The ID of the environment instance.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- jobs
Sequence[Get
Env Custom Jobs Job] - A list of ARMS Env Custom Jobs. Each element contains the following attributes:
- names Sequence[str]
- A list of ARMS Env Custom Job names.
- name_
regex str - output_
file str
- environment
Id String - The ID of the environment instance.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- jobs List<Property Map>
- A list of ARMS Env Custom Jobs. Each element contains the following attributes:
- names List<String>
- A list of ARMS Env Custom Job names.
- name
Regex String - output
File String
Supporting Types
GetEnvCustomJobsJob
- Config
Yaml string - The YAML configuration string.
- Env
Custom stringJob Name - The name of the custom job.
- Environment
Id string - The ID of the environment instance.
- Id string
- The ID of the custom job. It formats as
<environment_id>:<env_custom_job_name>
. - Region
Id string - The region ID.
- Status string
- The status of the custom job.
- Config
Yaml string - The YAML configuration string.
- Env
Custom stringJob Name - The name of the custom job.
- Environment
Id string - The ID of the environment instance.
- Id string
- The ID of the custom job. It formats as
<environment_id>:<env_custom_job_name>
. - Region
Id string - The region ID.
- Status string
- The status of the custom job.
- config
Yaml String - The YAML configuration string.
- env
Custom StringJob Name - The name of the custom job.
- environment
Id String - The ID of the environment instance.
- id String
- The ID of the custom job. It formats as
<environment_id>:<env_custom_job_name>
. - region
Id String - The region ID.
- status String
- The status of the custom job.
- config
Yaml string - The YAML configuration string.
- env
Custom stringJob Name - The name of the custom job.
- environment
Id string - The ID of the environment instance.
- id string
- The ID of the custom job. It formats as
<environment_id>:<env_custom_job_name>
. - region
Id string - The region ID.
- status string
- The status of the custom job.
- config_
yaml str - The YAML configuration string.
- env_
custom_ strjob_ name - The name of the custom job.
- environment_
id str - The ID of the environment instance.
- id str
- The ID of the custom job. It formats as
<environment_id>:<env_custom_job_name>
. - region_
id str - The region ID.
- status str
- The status of the custom job.
- config
Yaml String - The YAML configuration string.
- env
Custom StringJob Name - The name of the custom job.
- environment
Id String - The ID of the environment instance.
- id String
- The ID of the custom job. It formats as
<environment_id>:<env_custom_job_name>
. - region
Id String - The region ID.
- status String
- The status of the custom job.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.