Alibaba Cloud v3.90.0 published on Tuesday, Dec 2, 2025 by Pulumi
Alibaba Cloud v3.90.0 published on Tuesday, Dec 2, 2025 by Pulumi
This data source provides the Emr Clusters of the current Alibaba Cloud user.
NOTE: Available since v1.199.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const _default = alicloud.resourcemanager.getResourceGroups({
status: "OK",
});
const defaultGetZones = alicloud.getZones({
availableInstanceType: "ecs.g7.xlarge",
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: "TF-VPC",
cidrBlock: "172.16.0.0/12",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vpcId: defaultNetwork.id,
cidrBlock: "172.16.0.0/21",
zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[0]?.id),
vswitchName: "TF_VSwitch",
});
const defaultEcsKeyPair = new alicloud.ecs.EcsKeyPair("default", {keyPairName: "terraform-kp"});
const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {
name: "TF_SECURITY_GROUP",
vpcId: defaultNetwork.id,
});
const defaultRole = new alicloud.ram.Role("default", {
name: "emrtf",
document: ` {
\\"Statement\\": [
{
\\"Action\\": \\"sts:AssumeRole\\",
\\"Effect\\": \\"Allow\\",
\\"Principal\\": {
\\"Service\\": [
\\"emr.aliyuncs.com\\",
\\"ecs.aliyuncs.com\\"
]
}
}
],
\\"Version\\": \\"1\\"
}
`,
description: "this is a role test.",
force: true,
});
const defaultCluster = new alicloud.emrv2.Cluster("default", {
paymentType: "PayAsYouGo",
clusterType: "DATALAKE",
releaseVersion: "EMR-5.10.0",
clusterName: "terraform-emr-cluster-v2",
deployMode: "NORMAL",
securityMode: "NORMAL",
applications: [
"HADOOP-COMMON",
"HDFS",
"YARN",
"HIVE",
"SPARK3",
"TEZ",
],
applicationConfigs: [
{
applicationName: "HIVE",
configFileName: "hivemetastore-site.xml",
configItemKey: "hive.metastore.type",
configItemValue: "DLF",
configScope: "CLUSTER",
},
{
applicationName: "SPARK3",
configFileName: "hive-site.xml",
configItemKey: "hive.metastore.type",
configItemValue: "DLF",
configScope: "CLUSTER",
},
],
nodeAttributes: [{
ramRole: defaultRole.name,
securityGroupId: defaultSecurityGroup.id,
vpcId: defaultNetwork.id,
zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[0]?.id),
keyPairName: defaultEcsKeyPair.id,
}],
tags: {
created: "tf",
},
nodeGroups: [
{
nodeGroupType: "MASTER",
nodeGroupName: "emr-master",
paymentType: "PayAsYouGo",
vswitchIds: [defaultSwitch.id],
withPublicIp: false,
instanceTypes: ["ecs.g7.xlarge"],
nodeCount: 1,
systemDisk: {
category: "cloud_essd",
size: 80,
count: 1,
},
dataDisks: [{
category: "cloud_essd",
size: 80,
count: 3,
}],
},
{
nodeGroupType: "CORE",
nodeGroupName: "emr-core",
paymentType: "PayAsYouGo",
vswitchIds: [defaultSwitch.id],
withPublicIp: false,
instanceTypes: ["ecs.g7.xlarge"],
nodeCount: 3,
systemDisk: {
category: "cloud_essd",
size: 80,
count: 1,
},
dataDisks: [{
category: "cloud_essd",
size: 80,
count: 3,
}],
},
],
resourceGroupId: _default.then(_default => _default.ids?.[0]),
});
const ids = alicloud.emrv2.getClusters({});
export const emrv2ClustersId1 = ids.then(ids => ids.clusters?.[0]?.id);
const nameRegex = alicloud.emrv2.getClusters({
nameRegex: defaultAlicloudEmrCluster.name,
});
export const emrv2ClustersId2 = nameRegex.then(nameRegex => nameRegex.clusters?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.resourcemanager.get_resource_groups(status="OK")
default_get_zones = alicloud.get_zones(available_instance_type="ecs.g7.xlarge")
default_network = alicloud.vpc.Network("default",
vpc_name="TF-VPC",
cidr_block="172.16.0.0/12")
default_switch = alicloud.vpc.Switch("default",
vpc_id=default_network.id,
cidr_block="172.16.0.0/21",
zone_id=default_get_zones.zones[0].id,
vswitch_name="TF_VSwitch")
default_ecs_key_pair = alicloud.ecs.EcsKeyPair("default", key_pair_name="terraform-kp")
default_security_group = alicloud.ecs.SecurityGroup("default",
name="TF_SECURITY_GROUP",
vpc_id=default_network.id)
default_role = alicloud.ram.Role("default",
name="emrtf",
document=""" {
\"Statement\": [
{
\"Action\": \"sts:AssumeRole\",
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": [
\"emr.aliyuncs.com\",
\"ecs.aliyuncs.com\"
]
}
}
],
\"Version\": \"1\"
}
""",
description="this is a role test.",
force=True)
default_cluster = alicloud.emrv2.Cluster("default",
payment_type="PayAsYouGo",
cluster_type="DATALAKE",
release_version="EMR-5.10.0",
cluster_name="terraform-emr-cluster-v2",
deploy_mode="NORMAL",
security_mode="NORMAL",
applications=[
"HADOOP-COMMON",
"HDFS",
"YARN",
"HIVE",
"SPARK3",
"TEZ",
],
application_configs=[
{
"application_name": "HIVE",
"config_file_name": "hivemetastore-site.xml",
"config_item_key": "hive.metastore.type",
"config_item_value": "DLF",
"config_scope": "CLUSTER",
},
{
"application_name": "SPARK3",
"config_file_name": "hive-site.xml",
"config_item_key": "hive.metastore.type",
"config_item_value": "DLF",
"config_scope": "CLUSTER",
},
],
node_attributes=[{
"ram_role": default_role.name,
"security_group_id": default_security_group.id,
"vpc_id": default_network.id,
"zone_id": default_get_zones.zones[0].id,
"key_pair_name": default_ecs_key_pair.id,
}],
tags={
"created": "tf",
},
node_groups=[
{
"node_group_type": "MASTER",
"node_group_name": "emr-master",
"payment_type": "PayAsYouGo",
"vswitch_ids": [default_switch.id],
"with_public_ip": False,
"instance_types": ["ecs.g7.xlarge"],
"node_count": 1,
"system_disk": {
"category": "cloud_essd",
"size": 80,
"count": 1,
},
"data_disks": [{
"category": "cloud_essd",
"size": 80,
"count": 3,
}],
},
{
"node_group_type": "CORE",
"node_group_name": "emr-core",
"payment_type": "PayAsYouGo",
"vswitch_ids": [default_switch.id],
"with_public_ip": False,
"instance_types": ["ecs.g7.xlarge"],
"node_count": 3,
"system_disk": {
"category": "cloud_essd",
"size": 80,
"count": 1,
},
"data_disks": [{
"category": "cloud_essd",
"size": 80,
"count": 3,
}],
},
],
resource_group_id=default.ids[0])
ids = alicloud.emrv2.get_clusters()
pulumi.export("emrv2ClustersId1", ids.clusters[0].id)
name_regex = alicloud.emrv2.get_clusters(name_regex=default_alicloud_emr_cluster["name"])
pulumi.export("emrv2ClustersId2", name_regex.clusters[0].id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/emrv2"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{
Status: pulumi.StringRef("OK"),
}, nil)
if err != nil {
return err
}
defaultGetZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableInstanceType: pulumi.StringRef("ecs.g7.xlarge"),
}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String("TF-VPC"),
CidrBlock: pulumi.String("172.16.0.0/12"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VpcId: defaultNetwork.ID(),
CidrBlock: pulumi.String("172.16.0.0/21"),
ZoneId: pulumi.String(defaultGetZones.Zones[0].Id),
VswitchName: pulumi.String("TF_VSwitch"),
})
if err != nil {
return err
}
defaultEcsKeyPair, err := ecs.NewEcsKeyPair(ctx, "default", &ecs.EcsKeyPairArgs{
KeyPairName: pulumi.String("terraform-kp"),
})
if err != nil {
return err
}
defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
Name: pulumi.String("TF_SECURITY_GROUP"),
VpcId: defaultNetwork.ID(),
})
if err != nil {
return err
}
defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
Name: pulumi.String("emrtf"),
Document: pulumi.String(` {
\"Statement\": [
{
\"Action\": \"sts:AssumeRole\",
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": [
\"emr.aliyuncs.com\",
\"ecs.aliyuncs.com\"
]
}
}
],
\"Version\": \"1\"
}
`),
Description: pulumi.String("this is a role test."),
Force: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = emrv2.NewCluster(ctx, "default", &emrv2.ClusterArgs{
PaymentType: pulumi.String("PayAsYouGo"),
ClusterType: pulumi.String("DATALAKE"),
ReleaseVersion: pulumi.String("EMR-5.10.0"),
ClusterName: pulumi.String("terraform-emr-cluster-v2"),
DeployMode: pulumi.String("NORMAL"),
SecurityMode: pulumi.String("NORMAL"),
Applications: pulumi.StringArray{
pulumi.String("HADOOP-COMMON"),
pulumi.String("HDFS"),
pulumi.String("YARN"),
pulumi.String("HIVE"),
pulumi.String("SPARK3"),
pulumi.String("TEZ"),
},
ApplicationConfigs: emrv2.ClusterApplicationConfigArray{
&emrv2.ClusterApplicationConfigArgs{
ApplicationName: pulumi.String("HIVE"),
ConfigFileName: pulumi.String("hivemetastore-site.xml"),
ConfigItemKey: pulumi.String("hive.metastore.type"),
ConfigItemValue: pulumi.String("DLF"),
ConfigScope: pulumi.String("CLUSTER"),
},
&emrv2.ClusterApplicationConfigArgs{
ApplicationName: pulumi.String("SPARK3"),
ConfigFileName: pulumi.String("hive-site.xml"),
ConfigItemKey: pulumi.String("hive.metastore.type"),
ConfigItemValue: pulumi.String("DLF"),
ConfigScope: pulumi.String("CLUSTER"),
},
},
NodeAttributes: emrv2.ClusterNodeAttributeArray{
&emrv2.ClusterNodeAttributeArgs{
RamRole: defaultRole.Name,
SecurityGroupId: defaultSecurityGroup.ID(),
VpcId: defaultNetwork.ID(),
ZoneId: pulumi.String(defaultGetZones.Zones[0].Id),
KeyPairName: defaultEcsKeyPair.ID(),
},
},
Tags: pulumi.StringMap{
"created": pulumi.String("tf"),
},
NodeGroups: emrv2.ClusterNodeGroupArray{
&emrv2.ClusterNodeGroupArgs{
NodeGroupType: pulumi.String("MASTER"),
NodeGroupName: pulumi.String("emr-master"),
PaymentType: pulumi.String("PayAsYouGo"),
VswitchIds: pulumi.StringArray{
defaultSwitch.ID(),
},
WithPublicIp: pulumi.Bool(false),
InstanceTypes: pulumi.StringArray{
pulumi.String("ecs.g7.xlarge"),
},
NodeCount: pulumi.Int(1),
SystemDisk: &emrv2.ClusterNodeGroupSystemDiskArgs{
Category: pulumi.String("cloud_essd"),
Size: pulumi.Int(80),
Count: pulumi.Int(1),
},
DataDisks: emrv2.ClusterNodeGroupDataDiskArray{
&emrv2.ClusterNodeGroupDataDiskArgs{
Category: pulumi.String("cloud_essd"),
Size: pulumi.Int(80),
Count: pulumi.Int(3),
},
},
},
&emrv2.ClusterNodeGroupArgs{
NodeGroupType: pulumi.String("CORE"),
NodeGroupName: pulumi.String("emr-core"),
PaymentType: pulumi.String("PayAsYouGo"),
VswitchIds: pulumi.StringArray{
defaultSwitch.ID(),
},
WithPublicIp: pulumi.Bool(false),
InstanceTypes: pulumi.StringArray{
pulumi.String("ecs.g7.xlarge"),
},
NodeCount: pulumi.Int(3),
SystemDisk: &emrv2.ClusterNodeGroupSystemDiskArgs{
Category: pulumi.String("cloud_essd"),
Size: pulumi.Int(80),
Count: pulumi.Int(1),
},
DataDisks: emrv2.ClusterNodeGroupDataDiskArray{
&emrv2.ClusterNodeGroupDataDiskArgs{
Category: pulumi.String("cloud_essd"),
Size: pulumi.Int(80),
Count: pulumi.Int(3),
},
},
},
},
ResourceGroupId: pulumi.String(_default.Ids[0]),
})
if err != nil {
return err
}
ids, err := emrv2.GetClusters(ctx, &emrv2.GetClustersArgs{}, nil)
if err != nil {
return err
}
ctx.Export("emrv2ClustersId1", ids.Clusters[0].Id)
nameRegex, err := emrv2.GetClusters(ctx, &emrv2.GetClustersArgs{
NameRegex: pulumi.StringRef(defaultAlicloudEmrCluster.Name),
}, nil)
if err != nil {
return err
}
ctx.Export("emrv2ClustersId2", nameRegex.Clusters[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var @default = AliCloud.ResourceManager.GetResourceGroups.Invoke(new()
{
Status = "OK",
});
var defaultGetZones = AliCloud.GetZones.Invoke(new()
{
AvailableInstanceType = "ecs.g7.xlarge",
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = "TF-VPC",
CidrBlock = "172.16.0.0/12",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VpcId = defaultNetwork.Id,
CidrBlock = "172.16.0.0/21",
ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
VswitchName = "TF_VSwitch",
});
var defaultEcsKeyPair = new AliCloud.Ecs.EcsKeyPair("default", new()
{
KeyPairName = "terraform-kp",
});
var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
{
Name = "TF_SECURITY_GROUP",
VpcId = defaultNetwork.Id,
});
var defaultRole = new AliCloud.Ram.Role("default", new()
{
Name = "emrtf",
Document = @" {
\""Statement\"": [
{
\""Action\"": \""sts:AssumeRole\"",
\""Effect\"": \""Allow\"",
\""Principal\"": {
\""Service\"": [
\""emr.aliyuncs.com\"",
\""ecs.aliyuncs.com\""
]
}
}
],
\""Version\"": \""1\""
}
",
Description = "this is a role test.",
Force = true,
});
var defaultCluster = new AliCloud.Emrv2.Cluster("default", new()
{
PaymentType = "PayAsYouGo",
ClusterType = "DATALAKE",
ReleaseVersion = "EMR-5.10.0",
ClusterName = "terraform-emr-cluster-v2",
DeployMode = "NORMAL",
SecurityMode = "NORMAL",
Applications = new[]
{
"HADOOP-COMMON",
"HDFS",
"YARN",
"HIVE",
"SPARK3",
"TEZ",
},
ApplicationConfigs = new[]
{
new AliCloud.Emrv2.Inputs.ClusterApplicationConfigArgs
{
ApplicationName = "HIVE",
ConfigFileName = "hivemetastore-site.xml",
ConfigItemKey = "hive.metastore.type",
ConfigItemValue = "DLF",
ConfigScope = "CLUSTER",
},
new AliCloud.Emrv2.Inputs.ClusterApplicationConfigArgs
{
ApplicationName = "SPARK3",
ConfigFileName = "hive-site.xml",
ConfigItemKey = "hive.metastore.type",
ConfigItemValue = "DLF",
ConfigScope = "CLUSTER",
},
},
NodeAttributes = new[]
{
new AliCloud.Emrv2.Inputs.ClusterNodeAttributeArgs
{
RamRole = defaultRole.Name,
SecurityGroupId = defaultSecurityGroup.Id,
VpcId = defaultNetwork.Id,
ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
KeyPairName = defaultEcsKeyPair.Id,
},
},
Tags =
{
{ "created", "tf" },
},
NodeGroups = new[]
{
new AliCloud.Emrv2.Inputs.ClusterNodeGroupArgs
{
NodeGroupType = "MASTER",
NodeGroupName = "emr-master",
PaymentType = "PayAsYouGo",
VswitchIds = new[]
{
defaultSwitch.Id,
},
WithPublicIp = false,
InstanceTypes = new[]
{
"ecs.g7.xlarge",
},
NodeCount = 1,
SystemDisk = new AliCloud.Emrv2.Inputs.ClusterNodeGroupSystemDiskArgs
{
Category = "cloud_essd",
Size = 80,
Count = 1,
},
DataDisks = new[]
{
new AliCloud.Emrv2.Inputs.ClusterNodeGroupDataDiskArgs
{
Category = "cloud_essd",
Size = 80,
Count = 3,
},
},
},
new AliCloud.Emrv2.Inputs.ClusterNodeGroupArgs
{
NodeGroupType = "CORE",
NodeGroupName = "emr-core",
PaymentType = "PayAsYouGo",
VswitchIds = new[]
{
defaultSwitch.Id,
},
WithPublicIp = false,
InstanceTypes = new[]
{
"ecs.g7.xlarge",
},
NodeCount = 3,
SystemDisk = new AliCloud.Emrv2.Inputs.ClusterNodeGroupSystemDiskArgs
{
Category = "cloud_essd",
Size = 80,
Count = 1,
},
DataDisks = new[]
{
new AliCloud.Emrv2.Inputs.ClusterNodeGroupDataDiskArgs
{
Category = "cloud_essd",
Size = 80,
Count = 3,
},
},
},
},
ResourceGroupId = @default.Apply(@default => @default.Apply(getResourceGroupsResult => getResourceGroupsResult.Ids[0])),
});
var ids = AliCloud.Emrv2.GetClusters.Invoke();
var nameRegex = AliCloud.Emrv2.GetClusters.Invoke(new()
{
NameRegex = defaultAlicloudEmrCluster.Name,
});
return new Dictionary<string, object?>
{
["emrv2ClustersId1"] = ids.Apply(getClustersResult => getClustersResult.Clusters[0]?.Id),
["emrv2ClustersId2"] = nameRegex.Apply(getClustersResult => getClustersResult.Clusters[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.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.EcsKeyPair;
import com.pulumi.alicloud.ecs.EcsKeyPairArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.emrv2.Cluster;
import com.pulumi.alicloud.emrv2.ClusterArgs;
import com.pulumi.alicloud.emrv2.inputs.ClusterApplicationConfigArgs;
import com.pulumi.alicloud.emrv2.inputs.ClusterNodeAttributeArgs;
import com.pulumi.alicloud.emrv2.inputs.ClusterNodeGroupArgs;
import com.pulumi.alicloud.emrv2.inputs.ClusterNodeGroupSystemDiskArgs;
import com.pulumi.alicloud.emrv2.Emrv2Functions;
import com.pulumi.alicloud.emrv2.inputs.GetClustersArgs;
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 default = ResourcemanagerFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
.status("OK")
.build());
final var defaultGetZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableInstanceType("ecs.g7.xlarge")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName("TF-VPC")
.cidrBlock("172.16.0.0/12")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/21")
.zoneId(defaultGetZones.zones()[0].id())
.vswitchName("TF_VSwitch")
.build());
var defaultEcsKeyPair = new EcsKeyPair("defaultEcsKeyPair", EcsKeyPairArgs.builder()
.keyPairName("terraform-kp")
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.name("TF_SECURITY_GROUP")
.vpcId(defaultNetwork.id())
.build());
var defaultRole = new Role("defaultRole", RoleArgs.builder()
.name("emrtf")
.document("""
{
\"Statement\": [
{
\"Action\": \"sts:AssumeRole\",
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": [
\"emr.aliyuncs.com\",
\"ecs.aliyuncs.com\"
]
}
}
],
\"Version\": \"1\"
}
""")
.description("this is a role test.")
.force(true)
.build());
var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
.paymentType("PayAsYouGo")
.clusterType("DATALAKE")
.releaseVersion("EMR-5.10.0")
.clusterName("terraform-emr-cluster-v2")
.deployMode("NORMAL")
.securityMode("NORMAL")
.applications(
"HADOOP-COMMON",
"HDFS",
"YARN",
"HIVE",
"SPARK3",
"TEZ")
.applicationConfigs(
ClusterApplicationConfigArgs.builder()
.applicationName("HIVE")
.configFileName("hivemetastore-site.xml")
.configItemKey("hive.metastore.type")
.configItemValue("DLF")
.configScope("CLUSTER")
.build(),
ClusterApplicationConfigArgs.builder()
.applicationName("SPARK3")
.configFileName("hive-site.xml")
.configItemKey("hive.metastore.type")
.configItemValue("DLF")
.configScope("CLUSTER")
.build())
.nodeAttributes(ClusterNodeAttributeArgs.builder()
.ramRole(defaultRole.name())
.securityGroupId(defaultSecurityGroup.id())
.vpcId(defaultNetwork.id())
.zoneId(defaultGetZones.zones()[0].id())
.keyPairName(defaultEcsKeyPair.id())
.build())
.tags(Map.of("created", "tf"))
.nodeGroups(
ClusterNodeGroupArgs.builder()
.nodeGroupType("MASTER")
.nodeGroupName("emr-master")
.paymentType("PayAsYouGo")
.vswitchIds(defaultSwitch.id())
.withPublicIp(false)
.instanceTypes("ecs.g7.xlarge")
.nodeCount(1)
.systemDisk(ClusterNodeGroupSystemDiskArgs.builder()
.category("cloud_essd")
.size(80)
.count(1)
.build())
.dataDisks(ClusterNodeGroupDataDiskArgs.builder()
.category("cloud_essd")
.size(80)
.count(3)
.build())
.build(),
ClusterNodeGroupArgs.builder()
.nodeGroupType("CORE")
.nodeGroupName("emr-core")
.paymentType("PayAsYouGo")
.vswitchIds(defaultSwitch.id())
.withPublicIp(false)
.instanceTypes("ecs.g7.xlarge")
.nodeCount(3)
.systemDisk(ClusterNodeGroupSystemDiskArgs.builder()
.category("cloud_essd")
.size(80)
.count(1)
.build())
.dataDisks(ClusterNodeGroupDataDiskArgs.builder()
.category("cloud_essd")
.size(80)
.count(3)
.build())
.build())
.resourceGroupId(default_.ids()[0])
.build());
final var ids = Emrv2Functions.getClusters(GetClustersArgs.builder()
.build());
ctx.export("emrv2ClustersId1", ids.clusters()[0].id());
final var nameRegex = Emrv2Functions.getClusters(GetClustersArgs.builder()
.nameRegex(defaultAlicloudEmrCluster.name())
.build());
ctx.export("emrv2ClustersId2", nameRegex.clusters()[0].id());
}
}
resources:
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: TF-VPC
cidrBlock: 172.16.0.0/12
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vpcId: ${defaultNetwork.id}
cidrBlock: 172.16.0.0/21
zoneId: ${defaultGetZones.zones[0].id}
vswitchName: TF_VSwitch
defaultEcsKeyPair:
type: alicloud:ecs:EcsKeyPair
name: default
properties:
keyPairName: terraform-kp
defaultSecurityGroup:
type: alicloud:ecs:SecurityGroup
name: default
properties:
name: TF_SECURITY_GROUP
vpcId: ${defaultNetwork.id}
defaultRole:
type: alicloud:ram:Role
name: default
properties:
name: emrtf
document: |2
{
\"Statement\": [
{
\"Action\": \"sts:AssumeRole\",
\"Effect\": \"Allow\",
\"Principal\": {
\"Service\": [
\"emr.aliyuncs.com\",
\"ecs.aliyuncs.com\"
]
}
}
],
\"Version\": \"1\"
}
description: this is a role test.
force: true
defaultCluster:
type: alicloud:emrv2:Cluster
name: default
properties:
paymentType: PayAsYouGo
clusterType: DATALAKE
releaseVersion: EMR-5.10.0
clusterName: terraform-emr-cluster-v2
deployMode: NORMAL
securityMode: NORMAL
applications:
- HADOOP-COMMON
- HDFS
- YARN
- HIVE
- SPARK3
- TEZ
applicationConfigs:
- applicationName: HIVE
configFileName: hivemetastore-site.xml
configItemKey: hive.metastore.type
configItemValue: DLF
configScope: CLUSTER
- applicationName: SPARK3
configFileName: hive-site.xml
configItemKey: hive.metastore.type
configItemValue: DLF
configScope: CLUSTER
nodeAttributes:
- ramRole: ${defaultRole.name}
securityGroupId: ${defaultSecurityGroup.id}
vpcId: ${defaultNetwork.id}
zoneId: ${defaultGetZones.zones[0].id}
keyPairName: ${defaultEcsKeyPair.id}
tags:
created: tf
nodeGroups:
- nodeGroupType: MASTER
nodeGroupName: emr-master
paymentType: PayAsYouGo
vswitchIds:
- ${defaultSwitch.id}
withPublicIp: false
instanceTypes:
- ecs.g7.xlarge
nodeCount: 1
systemDisk:
category: cloud_essd
size: 80
count: 1
dataDisks:
- category: cloud_essd
size: 80
count: 3
- nodeGroupType: CORE
nodeGroupName: emr-core
paymentType: PayAsYouGo
vswitchIds:
- ${defaultSwitch.id}
withPublicIp: false
instanceTypes:
- ecs.g7.xlarge
nodeCount: 3
systemDisk:
category: cloud_essd
size: 80
count: 1
dataDisks:
- category: cloud_essd
size: 80
count: 3
resourceGroupId: ${default.ids[0]}
variables:
default:
fn::invoke:
function: alicloud:resourcemanager:getResourceGroups
arguments:
status: OK
defaultGetZones:
fn::invoke:
function: alicloud:getZones
arguments:
availableInstanceType: ecs.g7.xlarge
ids:
fn::invoke:
function: alicloud:emrv2:getClusters
arguments: {}
nameRegex:
fn::invoke:
function: alicloud:emrv2:getClusters
arguments:
nameRegex: ${defaultAlicloudEmrCluster.name}
outputs:
emrv2ClustersId1: ${ids.clusters[0].id}
emrv2ClustersId2: ${nameRegex.clusters[0].id}
Using getClusters
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 getClusters(args: GetClustersArgs, opts?: InvokeOptions): Promise<GetClustersResult>
function getClustersOutput(args: GetClustersOutputArgs, opts?: InvokeOptions): Output<GetClustersResult>def get_clusters(cluster_name: Optional[str] = None,
cluster_states: Optional[Sequence[str]] = None,
cluster_types: Optional[Sequence[str]] = None,
ids: Optional[Sequence[str]] = None,
max_results: Optional[int] = None,
name_regex: Optional[str] = None,
next_token: Optional[str] = None,
output_file: Optional[str] = None,
payment_types: Optional[Sequence[str]] = None,
resource_group_id: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetClustersResult
def get_clusters_output(cluster_name: Optional[pulumi.Input[str]] = None,
cluster_states: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
cluster_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
max_results: Optional[pulumi.Input[int]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
next_token: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
payment_types: Optional[pulumi.Input[Sequence[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[GetClustersResult]func GetClusters(ctx *Context, args *GetClustersArgs, opts ...InvokeOption) (*GetClustersResult, error)
func GetClustersOutput(ctx *Context, args *GetClustersOutputArgs, opts ...InvokeOption) GetClustersResultOutput> Note: This function is named GetClusters in the Go SDK.
public static class GetClusters
{
public static Task<GetClustersResult> InvokeAsync(GetClustersArgs args, InvokeOptions? opts = null)
public static Output<GetClustersResult> Invoke(GetClustersInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetClustersResult> getClusters(GetClustersArgs args, InvokeOptions options)
public static Output<GetClustersResult> getClusters(GetClustersArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:emrv2/getClusters:getClusters
arguments:
# arguments dictionaryThe following arguments are supported:
- Cluster
Name string - The cluster name.
- Cluster
States List<string> - The cluster states.
- Cluster
Types List<string> - The cluster types.
- Ids List<string>
- A list of Cluster IDs.
- Max
Results int - The max results is used to list clusters for next page.
- Name
Regex string - A regex string to filter results by Cluster name.
- Next
Token string - The next token is used to list clusters for next page.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Payment
Types List<string> - The cluster payment types.
- Resource
Group stringId - The Resource Group ID.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Cluster
Name string - The cluster name.
- Cluster
States []string - The cluster states.
- Cluster
Types []string - The cluster types.
- Ids []string
- A list of Cluster IDs.
- Max
Results int - The max results is used to list clusters for next page.
- Name
Regex string - A regex string to filter results by Cluster name.
- Next
Token string - The next token is used to list clusters for next page.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Payment
Types []string - The cluster payment types.
- Resource
Group stringId - The Resource Group ID.
- map[string]string
- A mapping of tags to assign to the resource.
- cluster
Name String - The cluster name.
- cluster
States List<String> - The cluster states.
- cluster
Types List<String> - The cluster types.
- ids List<String>
- A list of Cluster IDs.
- max
Results Integer - The max results is used to list clusters for next page.
- name
Regex String - A regex string to filter results by Cluster name.
- next
Token String - The next token is used to list clusters for next page.
- output
File String - File name where to save data source results (after running
pulumi preview). - payment
Types List<String> - The cluster payment types.
- resource
Group StringId - The Resource Group ID.
- Map<String,String>
- A mapping of tags to assign to the resource.
- cluster
Name string - The cluster name.
- cluster
States string[] - The cluster states.
- cluster
Types string[] - The cluster types.
- ids string[]
- A list of Cluster IDs.
- max
Results number - The max results is used to list clusters for next page.
- name
Regex string - A regex string to filter results by Cluster name.
- next
Token string - The next token is used to list clusters for next page.
- output
File string - File name where to save data source results (after running
pulumi preview). - payment
Types string[] - The cluster payment types.
- resource
Group stringId - The Resource Group ID.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- cluster_
name str - The cluster name.
- cluster_
states Sequence[str] - The cluster states.
- cluster_
types Sequence[str] - The cluster types.
- ids Sequence[str]
- A list of Cluster IDs.
- max_
results int - The max results is used to list clusters for next page.
- name_
regex str - A regex string to filter results by Cluster name.
- next_
token str - The next token is used to list clusters for next page.
- output_
file str - File name where to save data source results (after running
pulumi preview). - payment_
types Sequence[str] - The cluster payment types.
- resource_
group_ strid - The Resource Group ID.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- cluster
Name String - The cluster name.
- cluster
States List<String> - The cluster states.
- cluster
Types List<String> - The cluster types.
- ids List<String>
- A list of Cluster IDs.
- max
Results Number - The max results is used to list clusters for next page.
- name
Regex String - A regex string to filter results by Cluster name.
- next
Token String - The next token is used to list clusters for next page.
- output
File String - File name where to save data source results (after running
pulumi preview). - payment
Types List<String> - The cluster payment types.
- resource
Group StringId - The Resource Group ID.
- Map<String>
- A mapping of tags to assign to the resource.
getClusters Result
The following output properties are available:
- Clusters
List<Pulumi.
Ali Cloud. Emrv2. Outputs. Get Clusters Cluster> - A list of Emr Clusters. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of Cluster IDS.
- Names List<string>
- A list of Cluster names.
- Total
Count int - The total count of list clusters.
- Cluster
Name string - The name of the emr cluster.
- Cluster
States List<string> - Cluster
Types List<string> - Max
Results int - Name
Regex string - Next
Token string - Output
File string - Payment
Types List<string> - Resource
Group stringId - The resource group id of the resource.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Clusters
[]Get
Clusters Cluster - A list of Emr Clusters. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of Cluster IDS.
- Names []string
- A list of Cluster names.
- Total
Count int - The total count of list clusters.
- Cluster
Name string - The name of the emr cluster.
- Cluster
States []string - Cluster
Types []string - Max
Results int - Name
Regex string - Next
Token string - Output
File string - Payment
Types []string - Resource
Group stringId - The resource group id of the resource.
- map[string]string
- A mapping of tags to assign to the resource.
- clusters
List<Get
Clusters Cluster> - A list of Emr Clusters. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Cluster IDS.
- names List<String>
- A list of Cluster names.
- total
Count Integer - The total count of list clusters.
- cluster
Name String - The name of the emr cluster.
- cluster
States List<String> - cluster
Types List<String> - max
Results Integer - name
Regex String - next
Token String - output
File String - payment
Types List<String> - resource
Group StringId - The resource group id of the resource.
- Map<String,String>
- A mapping of tags to assign to the resource.
- clusters
Get
Clusters Cluster[] - A list of Emr Clusters. Each element contains the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of Cluster IDS.
- names string[]
- A list of Cluster names.
- total
Count number - The total count of list clusters.
- cluster
Name string - The name of the emr cluster.
- cluster
States string[] - cluster
Types string[] - max
Results number - name
Regex string - next
Token string - output
File string - payment
Types string[] - resource
Group stringId - The resource group id of the resource.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- clusters
Sequence[Get
Clusters Cluster] - A list of Emr Clusters. Each element contains the following attributes:
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of Cluster IDS.
- names Sequence[str]
- A list of Cluster names.
- total_
count int - The total count of list clusters.
- cluster_
name str - The name of the emr cluster.
- cluster_
states Sequence[str] - cluster_
types Sequence[str] - max_
results int - name_
regex str - next_
token str - output_
file str - payment_
types Sequence[str] - resource_
group_ strid - The resource group id of the resource.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- clusters List<Property Map>
- A list of Emr Clusters. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Cluster IDS.
- names List<String>
- A list of Cluster names.
- total
Count Number - The total count of list clusters.
- cluster
Name String - The name of the emr cluster.
- cluster
States List<String> - cluster
Types List<String> - max
Results Number - name
Regex String - next
Token String - output
File String - payment
Types List<String> - resource
Group StringId - The resource group id of the resource.
- Map<String>
- A mapping of tags to assign to the resource.
Supporting Types
GetClustersCluster
- Cluster
Id string - The first ID of the resource.
- Cluster
Name string - The cluster name.
- Cluster
State string - The state of the emr cluster.
- Cluster
Type string - The type of the emr cluster.
- Create
Time string - The creation time of the resource.
- Emr
Default stringRole - The ecs default role belongs to this emr cluster.
- End
Time string - The end time of the resource.
- Expire
Time string - The expire time of the resource.
- Payment
Type string - The payment type of the emr cluster.
- Ready
Time string - The ready time of the resource.
- Release
Version string - The release version of the resource.
- Resource
Group stringId - The Resource Group ID.
- State
Change Dictionary<string, string>Reason - The cluster state change reason.
-
List<Pulumi.
Ali Cloud. Emrv2. Inputs. Get Clusters Cluster Tag> - A mapping of tags to assign to the resource.
- Cluster
Id string - The first ID of the resource.
- Cluster
Name string - The cluster name.
- Cluster
State string - The state of the emr cluster.
- Cluster
Type string - The type of the emr cluster.
- Create
Time string - The creation time of the resource.
- Emr
Default stringRole - The ecs default role belongs to this emr cluster.
- End
Time string - The end time of the resource.
- Expire
Time string - The expire time of the resource.
- Payment
Type string - The payment type of the emr cluster.
- Ready
Time string - The ready time of the resource.
- Release
Version string - The release version of the resource.
- Resource
Group stringId - The Resource Group ID.
- State
Change map[string]stringReason - The cluster state change reason.
-
[]Get
Clusters Cluster Tag - A mapping of tags to assign to the resource.
- cluster
Id String - The first ID of the resource.
- cluster
Name String - The cluster name.
- cluster
State String - The state of the emr cluster.
- cluster
Type String - The type of the emr cluster.
- create
Time String - The creation time of the resource.
- emr
Default StringRole - The ecs default role belongs to this emr cluster.
- end
Time String - The end time of the resource.
- expire
Time String - The expire time of the resource.
- payment
Type String - The payment type of the emr cluster.
- ready
Time String - The ready time of the resource.
- release
Version String - The release version of the resource.
- resource
Group StringId - The Resource Group ID.
- state
Change Map<String,String>Reason - The cluster state change reason.
-
List<Get
Clusters Cluster Tag> - A mapping of tags to assign to the resource.
- cluster
Id string - The first ID of the resource.
- cluster
Name string - The cluster name.
- cluster
State string - The state of the emr cluster.
- cluster
Type string - The type of the emr cluster.
- create
Time string - The creation time of the resource.
- emr
Default stringRole - The ecs default role belongs to this emr cluster.
- end
Time string - The end time of the resource.
- expire
Time string - The expire time of the resource.
- payment
Type string - The payment type of the emr cluster.
- ready
Time string - The ready time of the resource.
- release
Version string - The release version of the resource.
- resource
Group stringId - The Resource Group ID.
- state
Change {[key: string]: string}Reason - The cluster state change reason.
-
Get
Clusters Cluster Tag[] - A mapping of tags to assign to the resource.
- cluster_
id str - The first ID of the resource.
- cluster_
name str - The cluster name.
- cluster_
state str - The state of the emr cluster.
- cluster_
type str - The type of the emr cluster.
- create_
time str - The creation time of the resource.
- emr_
default_ strrole - The ecs default role belongs to this emr cluster.
- end_
time str - The end time of the resource.
- expire_
time str - The expire time of the resource.
- payment_
type str - The payment type of the emr cluster.
- ready_
time str - The ready time of the resource.
- release_
version str - The release version of the resource.
- resource_
group_ strid - The Resource Group ID.
- state_
change_ Mapping[str, str]reason - The cluster state change reason.
-
Sequence[Get
Clusters Cluster Tag] - A mapping of tags to assign to the resource.
- cluster
Id String - The first ID of the resource.
- cluster
Name String - The cluster name.
- cluster
State String - The state of the emr cluster.
- cluster
Type String - The type of the emr cluster.
- create
Time String - The creation time of the resource.
- emr
Default StringRole - The ecs default role belongs to this emr cluster.
- end
Time String - The end time of the resource.
- expire
Time String - The expire time of the resource.
- payment
Type String - The payment type of the emr cluster.
- ready
Time String - The ready time of the resource.
- release
Version String - The release version of the resource.
- resource
Group StringId - The Resource Group ID.
- state
Change Map<String>Reason - The cluster state change reason.
- List<Property Map>
- A mapping of tags to assign to the resource.
GetClustersClusterTag
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
Alibaba Cloud v3.90.0 published on Tuesday, Dec 2, 2025 by Pulumi
