Alibaba Cloud v3.85.0 published on Tuesday, Sep 9, 2025 by Pulumi
alicloud.arms.getEnvironments
Explore with Pulumi AI
This data source provides the ARMS Environments of the current Alibaba Cloud user.
NOTE: Available since v1.258.0.
Example Usage
Basic 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 _default = alicloud.resourcemanager.getResourceGroups({
status: "OK",
});
const defaultGetNetworks = alicloud.vpc.getNetworks({
nameRegex: "^default-NODELETING$",
});
const defaultInteger = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const defaultEnvironment = new alicloud.arms.Environment("default", {
bindResourceId: defaultGetNetworks.then(defaultGetNetworks => defaultGetNetworks.ids?.[0]),
environmentSubType: "ECS",
environmentType: "ECS",
environmentName: `${name}-${defaultInteger.result}`,
resourceGroupId: _default.then(_default => _default.ids?.[1]),
tags: {
Created: "TF",
For: "Environment",
},
});
const ids = alicloud.arms.getEnvironmentsOutput({
ids: [defaultEnvironment.id],
});
export const armsEnvironmentsId0 = ids.apply(ids => ids.environments?.[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 = alicloud.resourcemanager.get_resource_groups(status="OK")
default_get_networks = alicloud.vpc.get_networks(name_regex="^default-NODELETING$")
default_integer = random.index.Integer("default",
min=10000,
max=99999)
default_environment = alicloud.arms.Environment("default",
bind_resource_id=default_get_networks.ids[0],
environment_sub_type="ECS",
environment_type="ECS",
environment_name=f"{name}-{default_integer['result']}",
resource_group_id=default.ids[1],
tags={
"Created": "TF",
"For": "Environment",
})
ids = alicloud.arms.get_environments_output(ids=[default_environment.id])
pulumi.export("armsEnvironmentsId0", ids.environments[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/resourcemanager"
"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
}
_default, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{
Status: pulumi.StringRef("OK"),
}, nil)
if err != nil {
return err
}
defaultGetNetworks, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
NameRegex: pulumi.StringRef("^default-NODELETING$"),
}, nil)
if err != nil {
return err
}
defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
defaultEnvironment, err := arms.NewEnvironment(ctx, "default", &arms.EnvironmentArgs{
BindResourceId: pulumi.String(defaultGetNetworks.Ids[0]),
EnvironmentSubType: pulumi.String("ECS"),
EnvironmentType: pulumi.String("ECS"),
EnvironmentName: pulumi.Sprintf("%v-%v", name, defaultInteger.Result),
ResourceGroupId: pulumi.String(_default.Ids[1]),
Tags: pulumi.StringMap{
"Created": pulumi.String("TF"),
"For": pulumi.String("Environment"),
},
})
if err != nil {
return err
}
ids := arms.GetEnvironmentsOutput(ctx, arms.GetEnvironmentsOutputArgs{
Ids: pulumi.StringArray{
defaultEnvironment.ID(),
},
}, nil)
ctx.Export("armsEnvironmentsId0", ids.ApplyT(func(ids arms.GetEnvironmentsResult) (*string, error) {
return &ids.Environments[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 @default = AliCloud.ResourceManager.GetResourceGroups.Invoke(new()
{
Status = "OK",
});
var defaultGetNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
{
NameRegex = "^default-NODELETING$",
});
var defaultInteger = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var defaultEnvironment = new AliCloud.Arms.Environment("default", new()
{
BindResourceId = defaultGetNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
EnvironmentSubType = "ECS",
EnvironmentType = "ECS",
EnvironmentName = $"{name}-{defaultInteger.Result}",
ResourceGroupId = @default.Apply(@default => @default.Apply(getResourceGroupsResult => getResourceGroupsResult.Ids[1])),
Tags =
{
{ "Created", "TF" },
{ "For", "Environment" },
},
});
var ids = AliCloud.Arms.GetEnvironments.Invoke(new()
{
Ids = new[]
{
defaultEnvironment.Id,
},
});
return new Dictionary<string, object?>
{
["armsEnvironmentsId0"] = ids.Apply(getEnvironmentsResult => getEnvironmentsResult.Environments[0]?.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
import com.pulumi.random.Integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.arms.Environment;
import com.pulumi.alicloud.arms.EnvironmentArgs;
import com.pulumi.alicloud.arms.ArmsFunctions;
import com.pulumi.alicloud.arms.inputs.GetEnvironmentsArgs;
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");
final var default = ResourcemanagerFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
.status("OK")
.build());
final var defaultGetNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.nameRegex("^default-NODELETING$")
.build());
var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
var defaultEnvironment = new Environment("defaultEnvironment", EnvironmentArgs.builder()
.bindResourceId(defaultGetNetworks.ids()[0])
.environmentSubType("ECS")
.environmentType("ECS")
.environmentName(String.format("%s-%s", name,defaultInteger.result()))
.resourceGroupId(default_.ids()[1])
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "Environment")
))
.build());
final var ids = ArmsFunctions.getEnvironments(GetEnvironmentsArgs.builder()
.ids(defaultEnvironment.id())
.build());
ctx.export("armsEnvironmentsId0", ids.applyValue(_ids -> _ids.environments()[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: ${defaultGetNetworks.ids[0]}
environmentSubType: ECS
environmentType: ECS
environmentName: ${name}-${defaultInteger.result}
resourceGroupId: ${default.ids[1]}
tags:
Created: TF
For: Environment
variables:
default:
fn::invoke:
function: alicloud:resourcemanager:getResourceGroups
arguments:
status: OK
defaultGetNetworks:
fn::invoke:
function: alicloud:vpc:getNetworks
arguments:
nameRegex: ^default-NODELETING$
ids:
fn::invoke:
function: alicloud:arms:getEnvironments
arguments:
ids:
- ${defaultEnvironment.id}
outputs:
armsEnvironmentsId0: ${ids.environments[0].id}
Using getEnvironments
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 getEnvironments(args: GetEnvironmentsArgs, opts?: InvokeOptions): Promise<GetEnvironmentsResult>
function getEnvironmentsOutput(args: GetEnvironmentsOutputArgs, opts?: InvokeOptions): Output<GetEnvironmentsResult>
def get_environments(environment_type: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
resource_group_id: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetEnvironmentsResult
def get_environments_output(environment_type: 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,
resource_group_id: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetEnvironmentsResult]
func GetEnvironments(ctx *Context, args *GetEnvironmentsArgs, opts ...InvokeOption) (*GetEnvironmentsResult, error)
func GetEnvironmentsOutput(ctx *Context, args *GetEnvironmentsOutputArgs, opts ...InvokeOption) GetEnvironmentsResultOutput
> Note: This function is named GetEnvironments
in the Go SDK.
public static class GetEnvironments
{
public static Task<GetEnvironmentsResult> InvokeAsync(GetEnvironmentsArgs args, InvokeOptions? opts = null)
public static Output<GetEnvironmentsResult> Invoke(GetEnvironmentsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEnvironmentsResult> getEnvironments(GetEnvironmentsArgs args, InvokeOptions options)
public static Output<GetEnvironmentsResult> getEnvironments(GetEnvironmentsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:arms/getEnvironments:getEnvironments
arguments:
# arguments dictionary
The following arguments are supported:
- Environment
Type string - The environment type. Valid values:
CS
,ECS
,Cloud
. - Ids List<string>
- A list of ARMS Environment IDs.
- Name
Regex string - A regex string to filter results by ARMS Environment name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Resource
Group stringId - The ID of the resource group.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Environment
Type string - The environment type. Valid values:
CS
,ECS
,Cloud
. - Ids []string
- A list of ARMS Environment IDs.
- Name
Regex string - A regex string to filter results by ARMS Environment name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Resource
Group stringId - The ID of the resource group.
- map[string]string
- A mapping of tags to assign to the resource.
- environment
Type String - The environment type. Valid values:
CS
,ECS
,Cloud
. - ids List<String>
- A list of ARMS Environment IDs.
- name
Regex String - A regex string to filter results by ARMS Environment name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - resource
Group StringId - The ID of the resource group.
- Map<String,String>
- A mapping of tags to assign to the resource.
- environment
Type string - The environment type. Valid values:
CS
,ECS
,Cloud
. - ids string[]
- A list of ARMS Environment IDs.
- name
Regex string - A regex string to filter results by ARMS Environment name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - resource
Group stringId - The ID of the resource group.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- environment_
type str - The environment type. Valid values:
CS
,ECS
,Cloud
. - ids Sequence[str]
- A list of ARMS Environment IDs.
- name_
regex str - A regex string to filter results by ARMS Environment name.
- output_
file str - File name where to save data source results (after running
pulumi preview
). - resource_
group_ strid - The ID of the resource group.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- environment
Type String - The environment type. Valid values:
CS
,ECS
,Cloud
. - ids List<String>
- A list of ARMS Environment IDs.
- name
Regex String - A regex string to filter results by ARMS Environment name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - resource
Group StringId - The ID of the resource group.
- Map<String>
- A mapping of tags to assign to the resource.
getEnvironments Result
The following output properties are available:
- Environments
List<Pulumi.
Ali Cloud. Arms. Outputs. Get Environments Environment> - A list of ARMS Environments. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- A list of ARMS Environment names.
- Environment
Type string - The type of the environment instance.
- Name
Regex string - Output
File string - Resource
Group stringId - The ID of the resource group.
- Dictionary<string, string>
- The tags of the environment resource.
- Environments
[]Get
Environments Environment - A list of ARMS Environments. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- A list of ARMS Environment names.
- Environment
Type string - The type of the environment instance.
- Name
Regex string - Output
File string - Resource
Group stringId - The ID of the resource group.
- map[string]string
- The tags of the environment resource.
- environments
List<Get
Environments Environment> - A list of ARMS Environments. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of ARMS Environment names.
- environment
Type String - The type of the environment instance.
- name
Regex String - output
File String - resource
Group StringId - The ID of the resource group.
- Map<String,String>
- The tags of the environment resource.
- environments
Get
Environments Environment[] - A list of ARMS Environments. Each element contains the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- A list of ARMS Environment names.
- environment
Type string - The type of the environment instance.
- name
Regex string - output
File string - resource
Group stringId - The ID of the resource group.
- {[key: string]: string}
- The tags of the environment resource.
- environments
Sequence[Get
Environments Environment] - A list of ARMS Environments. Each element contains the following attributes:
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- A list of ARMS Environment names.
- environment_
type str - The type of the environment instance.
- name_
regex str - output_
file str - resource_
group_ strid - The ID of the resource group.
- Mapping[str, str]
- The tags of the environment resource.
- environments List<Property Map>
- A list of ARMS Environments. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of ARMS Environment names.
- environment
Type String - The type of the environment instance.
- name
Regex String - output
File String - resource
Group StringId - The ID of the resource group.
- Map<String>
- The tags of the environment resource.
Supporting Types
GetEnvironmentsEnvironment
- Bind
Resource stringId - The ID of the resource bound to the environment instance.
- Bind
Resource stringType - The resource type.
- Bind
Vpc stringCidr - The CIDR block that is bound to the VPC.
- Environment
Id string - The ID of the environment instance.
- Environment
Name string - The name of the environment instance.
- Environment
Type string - The environment type. Valid values:
CS
,ECS
,Cloud
. - Grafana
Datasource stringUid - The unique ID of the Grafana data source.
- Grafana
Folder stringUid - The unique ID of the Grafana directory.
- Id string
- The ID of the environment instance.
- Managed
Type string - Indicates whether agents or exporters are managed.
- Prometheus
Instance stringId - The ID of the Prometheus instance.
- Region
Id string - The region ID.
- Resource
Group stringId - The ID of the resource group.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- User
Id string - The user ID.
- Bind
Resource stringId - The ID of the resource bound to the environment instance.
- Bind
Resource stringType - The resource type.
- Bind
Vpc stringCidr - The CIDR block that is bound to the VPC.
- Environment
Id string - The ID of the environment instance.
- Environment
Name string - The name of the environment instance.
- Environment
Type string - The environment type. Valid values:
CS
,ECS
,Cloud
. - Grafana
Datasource stringUid - The unique ID of the Grafana data source.
- Grafana
Folder stringUid - The unique ID of the Grafana directory.
- Id string
- The ID of the environment instance.
- Managed
Type string - Indicates whether agents or exporters are managed.
- Prometheus
Instance stringId - The ID of the Prometheus instance.
- Region
Id string - The region ID.
- Resource
Group stringId - The ID of the resource group.
- map[string]string
- A mapping of tags to assign to the resource.
- User
Id string - The user ID.
- bind
Resource StringId - The ID of the resource bound to the environment instance.
- bind
Resource StringType - The resource type.
- bind
Vpc StringCidr - The CIDR block that is bound to the VPC.
- environment
Id String - The ID of the environment instance.
- environment
Name String - The name of the environment instance.
- environment
Type String - The environment type. Valid values:
CS
,ECS
,Cloud
. - grafana
Datasource StringUid - The unique ID of the Grafana data source.
- grafana
Folder StringUid - The unique ID of the Grafana directory.
- id String
- The ID of the environment instance.
- managed
Type String - Indicates whether agents or exporters are managed.
- prometheus
Instance StringId - The ID of the Prometheus instance.
- region
Id String - The region ID.
- resource
Group StringId - The ID of the resource group.
- Map<String,String>
- A mapping of tags to assign to the resource.
- user
Id String - The user ID.
- bind
Resource stringId - The ID of the resource bound to the environment instance.
- bind
Resource stringType - The resource type.
- bind
Vpc stringCidr - The CIDR block that is bound to the VPC.
- environment
Id string - The ID of the environment instance.
- environment
Name string - The name of the environment instance.
- environment
Type string - The environment type. Valid values:
CS
,ECS
,Cloud
. - grafana
Datasource stringUid - The unique ID of the Grafana data source.
- grafana
Folder stringUid - The unique ID of the Grafana directory.
- id string
- The ID of the environment instance.
- managed
Type string - Indicates whether agents or exporters are managed.
- prometheus
Instance stringId - The ID of the Prometheus instance.
- region
Id string - The region ID.
- resource
Group stringId - The ID of the resource group.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- user
Id string - The user ID.
- bind_
resource_ strid - The ID of the resource bound to the environment instance.
- bind_
resource_ strtype - The resource type.
- bind_
vpc_ strcidr - The CIDR block that is bound to the VPC.
- environment_
id str - The ID of the environment instance.
- environment_
name str - The name of the environment instance.
- environment_
type str - The environment type. Valid values:
CS
,ECS
,Cloud
. - grafana_
datasource_ struid - The unique ID of the Grafana data source.
- grafana_
folder_ struid - The unique ID of the Grafana directory.
- id str
- The ID of the environment instance.
- managed_
type str - Indicates whether agents or exporters are managed.
- prometheus_
instance_ strid - The ID of the Prometheus instance.
- region_
id str - The region ID.
- resource_
group_ strid - The ID of the resource group.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- user_
id str - The user ID.
- bind
Resource StringId - The ID of the resource bound to the environment instance.
- bind
Resource StringType - The resource type.
- bind
Vpc StringCidr - The CIDR block that is bound to the VPC.
- environment
Id String - The ID of the environment instance.
- environment
Name String - The name of the environment instance.
- environment
Type String - The environment type. Valid values:
CS
,ECS
,Cloud
. - grafana
Datasource StringUid - The unique ID of the Grafana data source.
- grafana
Folder StringUid - The unique ID of the Grafana directory.
- id String
- The ID of the environment instance.
- managed
Type String - Indicates whether agents or exporters are managed.
- prometheus
Instance StringId - The ID of the Prometheus instance.
- region
Id String - The region ID.
- resource
Group StringId - The ID of the resource group.
- Map<String>
- A mapping of tags to assign to the resource.
- user
Id String - The user ID.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.