alicloud logo
Alibaba Cloud v3.29.0, Jan 20 23

alicloud.emr.Cluster

Provides a EMR Cluster resource. With this you can create, read, and release EMR Cluster.

NOTE: Available in 1.57.0+.

Example Usage

1. Create A Cluster

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var defaultMainVersions = AliCloud.Emr.GetMainVersions.Invoke();

    var defaultInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
    {
        DestinationResource = "InstanceType",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        SupportLocalStorage = false,
        InstanceChargeType = "PostPaid",
        SupportNodeTypes = new[]
        {
            "MASTER",
            "CORE",
            "TASK",
        },
    });

    var dataDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "DataDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "SystemDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var vpc = new List<AliCloud.Vpc.Network>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vpc_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
        {
            CidrBlock = @var.Vpc_cidr,
        }));
    }
    var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
    for (var rangeIndex = 0; rangeIndex < (@var.Security_group_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"defaultSecurityGroup-{range.Value}", new()
        {
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // VSwitch Resource for Module
    var vswitch = new List<AliCloud.Vpc.Switch>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vswitch_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
        {
            AvailabilityZone = @var.Availability_zone == "" ? defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : @var.Availability_zone,
            VswitchName = @var.Vswitch_name,
            CidrBlock = @var.Vswitch_cidr,
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // Ram role Resource for Module
    var defaultRole = new AliCloud.Ram.Role("defaultRole", new()
    {
        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.Emr.Cluster("defaultCluster", new()
    {
        EmrVer = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion),
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        HostGroups = new[]
        {
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "master_group",
                HostGroupType = "MASTER",
                NodeCount = "2",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "1",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "core_group",
                HostGroupType = "CORE",
                NodeCount = "3",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "4",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "task_group",
                HostGroupType = "TASK",
                NodeCount = "2",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "4",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
        },
        HighAvailabilityEnable = true,
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        SecurityGroupId = @var.Security_group_id == "" ? defaultSecurityGroup.Id : @var.Security_group_id,
        IsOpenPublicIp = true,
        ChargeType = "PostPaid",
        VswitchId = @var.Vswitch_id == "" ? vswitch.Id : @var.Vswitch_id,
        UserDefinedEmrEcsRole = defaultRole.Name,
        SshEnable = true,
        MasterPwd = "ABCtest1234!",
    });

});

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.emr.EmrFunctions;
import com.pulumi.alicloud.emr.inputs.GetMainVersionsArgs;
import com.pulumi.alicloud.emr.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.emr.inputs.GetDiskTypesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.emr.Cluster;
import com.pulumi.alicloud.emr.ClusterArgs;
import com.pulumi.alicloud.emr.inputs.ClusterHostGroupArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 defaultMainVersions = EmrFunctions.getMainVersions();

        final var defaultInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
            .destinationResource("InstanceType")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .supportLocalStorage(false)
            .instanceChargeType("PostPaid")
            .supportNodeTypes(            
                "MASTER",
                "CORE",
                "TASK")
            .build());

        final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("DataDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("SystemDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        for (var i = 0; i < (var_.vpc_id() == "" ? 1 : 0 == true); i++) {
            new Network("vpc-" + i, NetworkArgs.builder()            
                .cidrBlock(var_.vpc_cidr())
                .build());

        
}
        for (var i = 0; i < (var_.security_group_id() == "" ? 1 : 0 == true); i++) {
            new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()            
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        for (var i = 0; i < (var_.vswitch_id() == "" ? 1 : 0 == true); i++) {
            new Switch("vswitch-" + i, SwitchArgs.builder()            
                .availabilityZone(var_.availability_zone() == "" ? defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : var_.availability_zone())
                .vswitchName(var_.vswitch_name())
                .cidrBlock(var_.vswitch_cidr())
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        var defaultRole = new Role("defaultRole", RoleArgs.builder()        
            .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()        
            .emrVer(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].emrVersion()))
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .hostGroups(            
                ClusterHostGroupArgs.builder()
                    .hostGroupName("master_group")
                    .hostGroupType("MASTER")
                    .nodeCount("2")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("1")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build(),
                ClusterHostGroupArgs.builder()
                    .hostGroupName("core_group")
                    .hostGroupType("CORE")
                    .nodeCount("3")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("4")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build(),
                ClusterHostGroupArgs.builder()
                    .hostGroupName("task_group")
                    .hostGroupType("TASK")
                    .nodeCount("2")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("4")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build())
            .highAvailabilityEnable(true)
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .securityGroupId(var_.security_group_id() == "" ? defaultSecurityGroup.id() : var_.security_group_id())
            .isOpenPublicIp(true)
            .chargeType("PostPaid")
            .vswitchId(var_.vswitch_id() == "" ? vswitch.id() : var_.vswitch_id())
            .userDefinedEmrEcsRole(defaultRole.name())
            .sshEnable(true)
            .masterPwd("ABCtest1234!")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default_main_versions = alicloud.emr.get_main_versions()
default_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    support_local_storage=False,
    instance_charge_type="PostPaid",
    support_node_types=[
        "MASTER",
        "CORE",
        "TASK",
    ])
data_disk = alicloud.emr.get_disk_types(destination_resource="DataDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
vpc = []
for range in [{"value": i} for i in range(0, 1 if var.vpc_id ==  else 0 == True)]:
    vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}", cidr_block=var["vpc_cidr"]))
default_security_group = []
for range in [{"value": i} for i in range(0, 1 if var.security_group_id ==  else 0 == True)]:
    default_security_group.append(alicloud.ecs.SecurityGroup(f"defaultSecurityGroup-{range['value']}", vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# VSwitch Resource for Module
vswitch = []
for range in [{"value": i} for i in range(0, 1 if var.vswitch_id ==  else 0 == True)]:
    vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
        availability_zone=default_instance_types.types[0].zone_id if var["availability_zone"] == "" else var["availability_zone"],
        vswitch_name=var["vswitch_name"],
        cidr_block=var["vswitch_cidr"],
        vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# Ram role Resource for Module
default_role = alicloud.ram.Role("defaultRole",
    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.emr.Cluster("defaultCluster",
    emr_ver=default_main_versions.main_versions[0].emr_version,
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    host_groups=[
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="master_group",
            host_group_type="MASTER",
            node_count="2",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="1",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="core_group",
            host_group_type="CORE",
            node_count="3",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="4",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="task_group",
            host_group_type="TASK",
            node_count="2",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="4",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
    ],
    high_availability_enable=True,
    zone_id=default_instance_types.types[0].zone_id,
    security_group_id=default_security_group.id if var["security_group_id"] == "" else var["security_group_id"],
    is_open_public_ip=True,
    charge_type="PostPaid",
    vswitch_id=vswitch.id if var["vswitch_id"] == "" else var["vswitch_id"],
    user_defined_emr_ecs_role=default_role.name,
    ssh_enable=True,
    master_pwd="ABCtest1234!")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultMainVersions = alicloud.emr.getMainVersions({});
const defaultInstanceTypes = defaultMainVersions.then(defaultMainVersions => alicloud.emr.getInstanceTypes({
    destinationResource: "InstanceType",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    supportLocalStorage: false,
    instanceChargeType: "PostPaid",
    supportNodeTypes: [
        "MASTER",
        "CORE",
        "TASK",
    ],
}));
const dataDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "DataDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const systemDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "SystemDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const vpc: alicloud.vpc.Network[] = [];
for (const range = {value: 0}; range.value < (_var.vpc_id == "" ? 1 : 0 == true); range.value++) {
    vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {cidrBlock: _var.vpc_cidr}));
}
const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
for (const range = {value: 0}; range.value < (_var.security_group_id == "" ? 1 : 0 == true); range.value++) {
    defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`defaultSecurityGroup-${range.value}`, {vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id}));
}
// VSwitch Resource for Module
const vswitch: alicloud.vpc.Switch[] = [];
for (const range = {value: 0}; range.value < (_var.vswitch_id == "" ? 1 : 0 == true); range.value++) {
    vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
        availabilityZone: _var.availability_zone == "" ? defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId) : _var.availability_zone,
        vswitchName: _var.vswitch_name,
        cidrBlock: _var.vswitch_cidr,
        vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id,
    }));
}
// Ram role Resource for Module
const defaultRole = new alicloud.ram.Role("defaultRole", {
    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.emr.Cluster("defaultCluster", {
    emrVer: defaultMainVersions.then(defaultMainVersions => defaultMainVersions.mainVersions?.[0]?.emrVersion),
    clusterType: defaultMainVersions.then(defaultMainVersions => defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0]),
    hostGroups: [
        {
            hostGroupName: "master_group",
            hostGroupType: "MASTER",
            nodeCount: "2",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "1",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
        {
            hostGroupName: "core_group",
            hostGroupType: "CORE",
            nodeCount: "3",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "4",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
        {
            hostGroupName: "task_group",
            hostGroupType: "TASK",
            nodeCount: "2",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "4",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
    ],
    highAvailabilityEnable: true,
    zoneId: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId),
    securityGroupId: _var.security_group_id == "" ? defaultSecurityGroup.id : _var.security_group_id,
    isOpenPublicIp: true,
    chargeType: "PostPaid",
    vswitchId: _var.vswitch_id == "" ? vswitch.id : _var.vswitch_id,
    userDefinedEmrEcsRole: defaultRole.name,
    sshEnable: true,
    masterPwd: "ABCtest1234!",
});

Coming soon!

2. Scale Up

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var defaultMainVersions = AliCloud.Emr.GetMainVersions.Invoke();

    var defaultInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
    {
        DestinationResource = "InstanceType",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        SupportLocalStorage = false,
        InstanceChargeType = "PostPaid",
        SupportNodeTypes = new[]
        {
            "MASTER",
            "CORE",
            "TASK",
        },
    });

    var dataDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "DataDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "SystemDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var vpc = new List<AliCloud.Vpc.Network>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vpc_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
        {
            CidrBlock = @var.Vpc_cidr,
        }));
    }
    var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
    for (var rangeIndex = 0; rangeIndex < (@var.Security_group_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"defaultSecurityGroup-{range.Value}", new()
        {
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // VSwitch Resource for Module
    var vswitch = new List<AliCloud.Vpc.Switch>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vswitch_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
        {
            AvailabilityZone = @var.Availability_zone == "" ? defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : @var.Availability_zone,
            VswitchName = @var.Vswitch_name,
            CidrBlock = @var.Vswitch_cidr,
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // Ram role Resource for Module
    var defaultRole = new AliCloud.Ram.Role("defaultRole", new()
    {
        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.Emr.Cluster("defaultCluster", new()
    {
        EmrVer = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion),
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        HostGroups = new[]
        {
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "master_group",
                HostGroupType = "MASTER",
                NodeCount = "2",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "1",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "core_group",
                HostGroupType = "CORE",
                NodeCount = "3",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "4",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "task_group",
                HostGroupType = "TASK",
                NodeCount = "4",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "4",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
        },
        HighAvailabilityEnable = true,
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        SecurityGroupId = @var.Security_group_id == "" ? defaultSecurityGroup.Id : @var.Security_group_id,
        IsOpenPublicIp = true,
        ChargeType = "PostPaid",
        VswitchId = @var.Vswitch_id == "" ? vswitch.Id : @var.Vswitch_id,
        UserDefinedEmrEcsRole = defaultRole.Name,
        SshEnable = true,
        MasterPwd = "ABCtest1234!",
    });

});

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.emr.EmrFunctions;
import com.pulumi.alicloud.emr.inputs.GetMainVersionsArgs;
import com.pulumi.alicloud.emr.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.emr.inputs.GetDiskTypesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.emr.Cluster;
import com.pulumi.alicloud.emr.ClusterArgs;
import com.pulumi.alicloud.emr.inputs.ClusterHostGroupArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 defaultMainVersions = EmrFunctions.getMainVersions();

        final var defaultInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
            .destinationResource("InstanceType")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .supportLocalStorage(false)
            .instanceChargeType("PostPaid")
            .supportNodeTypes(            
                "MASTER",
                "CORE",
                "TASK")
            .build());

        final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("DataDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("SystemDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        for (var i = 0; i < (var_.vpc_id() == "" ? 1 : 0 == true); i++) {
            new Network("vpc-" + i, NetworkArgs.builder()            
                .cidrBlock(var_.vpc_cidr())
                .build());

        
}
        for (var i = 0; i < (var_.security_group_id() == "" ? 1 : 0 == true); i++) {
            new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()            
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        for (var i = 0; i < (var_.vswitch_id() == "" ? 1 : 0 == true); i++) {
            new Switch("vswitch-" + i, SwitchArgs.builder()            
                .availabilityZone(var_.availability_zone() == "" ? defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : var_.availability_zone())
                .vswitchName(var_.vswitch_name())
                .cidrBlock(var_.vswitch_cidr())
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        var defaultRole = new Role("defaultRole", RoleArgs.builder()        
            .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()        
            .emrVer(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].emrVersion()))
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .hostGroups(            
                ClusterHostGroupArgs.builder()
                    .hostGroupName("master_group")
                    .hostGroupType("MASTER")
                    .nodeCount("2")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("1")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build(),
                ClusterHostGroupArgs.builder()
                    .hostGroupName("core_group")
                    .hostGroupType("CORE")
                    .nodeCount("3")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("4")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build(),
                ClusterHostGroupArgs.builder()
                    .hostGroupName("task_group")
                    .hostGroupType("TASK")
                    .nodeCount("4")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("4")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build())
            .highAvailabilityEnable(true)
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .securityGroupId(var_.security_group_id() == "" ? defaultSecurityGroup.id() : var_.security_group_id())
            .isOpenPublicIp(true)
            .chargeType("PostPaid")
            .vswitchId(var_.vswitch_id() == "" ? vswitch.id() : var_.vswitch_id())
            .userDefinedEmrEcsRole(defaultRole.name())
            .sshEnable(true)
            .masterPwd("ABCtest1234!")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default_main_versions = alicloud.emr.get_main_versions()
default_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    support_local_storage=False,
    instance_charge_type="PostPaid",
    support_node_types=[
        "MASTER",
        "CORE",
        "TASK",
    ])
data_disk = alicloud.emr.get_disk_types(destination_resource="DataDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
vpc = []
for range in [{"value": i} for i in range(0, 1 if var.vpc_id ==  else 0 == True)]:
    vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}", cidr_block=var["vpc_cidr"]))
default_security_group = []
for range in [{"value": i} for i in range(0, 1 if var.security_group_id ==  else 0 == True)]:
    default_security_group.append(alicloud.ecs.SecurityGroup(f"defaultSecurityGroup-{range['value']}", vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# VSwitch Resource for Module
vswitch = []
for range in [{"value": i} for i in range(0, 1 if var.vswitch_id ==  else 0 == True)]:
    vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
        availability_zone=default_instance_types.types[0].zone_id if var["availability_zone"] == "" else var["availability_zone"],
        vswitch_name=var["vswitch_name"],
        cidr_block=var["vswitch_cidr"],
        vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# Ram role Resource for Module
default_role = alicloud.ram.Role("defaultRole",
    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.emr.Cluster("defaultCluster",
    emr_ver=default_main_versions.main_versions[0].emr_version,
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    host_groups=[
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="master_group",
            host_group_type="MASTER",
            node_count="2",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="1",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="core_group",
            host_group_type="CORE",
            node_count="3",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="4",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="task_group",
            host_group_type="TASK",
            node_count="4",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="4",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
    ],
    high_availability_enable=True,
    zone_id=default_instance_types.types[0].zone_id,
    security_group_id=default_security_group.id if var["security_group_id"] == "" else var["security_group_id"],
    is_open_public_ip=True,
    charge_type="PostPaid",
    vswitch_id=vswitch.id if var["vswitch_id"] == "" else var["vswitch_id"],
    user_defined_emr_ecs_role=default_role.name,
    ssh_enable=True,
    master_pwd="ABCtest1234!")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultMainVersions = alicloud.emr.getMainVersions({});
const defaultInstanceTypes = defaultMainVersions.then(defaultMainVersions => alicloud.emr.getInstanceTypes({
    destinationResource: "InstanceType",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    supportLocalStorage: false,
    instanceChargeType: "PostPaid",
    supportNodeTypes: [
        "MASTER",
        "CORE",
        "TASK",
    ],
}));
const dataDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "DataDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const systemDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "SystemDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const vpc: alicloud.vpc.Network[] = [];
for (const range = {value: 0}; range.value < (_var.vpc_id == "" ? 1 : 0 == true); range.value++) {
    vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {cidrBlock: _var.vpc_cidr}));
}
const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
for (const range = {value: 0}; range.value < (_var.security_group_id == "" ? 1 : 0 == true); range.value++) {
    defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`defaultSecurityGroup-${range.value}`, {vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id}));
}
// VSwitch Resource for Module
const vswitch: alicloud.vpc.Switch[] = [];
for (const range = {value: 0}; range.value < (_var.vswitch_id == "" ? 1 : 0 == true); range.value++) {
    vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
        availabilityZone: _var.availability_zone == "" ? defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId) : _var.availability_zone,
        vswitchName: _var.vswitch_name,
        cidrBlock: _var.vswitch_cidr,
        vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id,
    }));
}
// Ram role Resource for Module
const defaultRole = new alicloud.ram.Role("defaultRole", {
    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.emr.Cluster("defaultCluster", {
    emrVer: defaultMainVersions.then(defaultMainVersions => defaultMainVersions.mainVersions?.[0]?.emrVersion),
    clusterType: defaultMainVersions.then(defaultMainVersions => defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0]),
    hostGroups: [
        {
            hostGroupName: "master_group",
            hostGroupType: "MASTER",
            nodeCount: "2",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "1",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
        {
            hostGroupName: "core_group",
            hostGroupType: "CORE",
            nodeCount: "3",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "4",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
        {
            hostGroupName: "task_group",
            hostGroupType: "TASK",
            nodeCount: "4",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "4",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
    ],
    highAvailabilityEnable: true,
    zoneId: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId),
    securityGroupId: _var.security_group_id == "" ? defaultSecurityGroup.id : _var.security_group_id,
    isOpenPublicIp: true,
    chargeType: "PostPaid",
    vswitchId: _var.vswitch_id == "" ? vswitch.id : _var.vswitch_id,
    userDefinedEmrEcsRole: defaultRole.name,
    sshEnable: true,
    masterPwd: "ABCtest1234!",
});

Coming soon!

3. Scale Down

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var defaultMainVersions = AliCloud.Emr.GetMainVersions.Invoke();

    var defaultInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
    {
        DestinationResource = "InstanceType",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        SupportLocalStorage = false,
        InstanceChargeType = "PostPaid",
        SupportNodeTypes = new[]
        {
            "MASTER",
            "CORE",
            "TASK",
        },
    });

    var dataDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "DataDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "SystemDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var vpc = new List<AliCloud.Vpc.Network>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vpc_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
        {
            CidrBlock = @var.Vpc_cidr,
        }));
    }
    var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
    for (var rangeIndex = 0; rangeIndex < (@var.Security_group_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"defaultSecurityGroup-{range.Value}", new()
        {
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // VSwitch Resource for Module
    var vswitch = new List<AliCloud.Vpc.Switch>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vswitch_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
        {
            AvailabilityZone = @var.Availability_zone == "" ? defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : @var.Availability_zone,
            VswitchName = @var.Vswitch_name,
            CidrBlock = @var.Vswitch_cidr,
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // Ram role Resource for Module
    var defaultRole = new AliCloud.Ram.Role("defaultRole", new()
    {
        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.Emr.Cluster("defaultCluster", new()
    {
        EmrVer = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion),
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        HostGroups = new[]
        {
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "master_group",
                HostGroupType = "MASTER",
                NodeCount = "2",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "1",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "core_group",
                HostGroupType = "CORE",
                NodeCount = "3",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "4",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "task_group",
                HostGroupType = "TASK",
                NodeCount = "2",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "4",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
        },
        HighAvailabilityEnable = true,
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        SecurityGroupId = @var.Security_group_id == "" ? defaultSecurityGroup.Id : @var.Security_group_id,
        IsOpenPublicIp = true,
        ChargeType = "PostPaid",
        VswitchId = @var.Vswitch_id == "" ? vswitch.Id : @var.Vswitch_id,
        UserDefinedEmrEcsRole = defaultRole.Name,
        SshEnable = true,
        MasterPwd = "ABCtest1234!",
    });

});

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.emr.EmrFunctions;
import com.pulumi.alicloud.emr.inputs.GetMainVersionsArgs;
import com.pulumi.alicloud.emr.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.emr.inputs.GetDiskTypesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.emr.Cluster;
import com.pulumi.alicloud.emr.ClusterArgs;
import com.pulumi.alicloud.emr.inputs.ClusterHostGroupArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 defaultMainVersions = EmrFunctions.getMainVersions();

        final var defaultInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
            .destinationResource("InstanceType")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .supportLocalStorage(false)
            .instanceChargeType("PostPaid")
            .supportNodeTypes(            
                "MASTER",
                "CORE",
                "TASK")
            .build());

        final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("DataDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("SystemDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        for (var i = 0; i < (var_.vpc_id() == "" ? 1 : 0 == true); i++) {
            new Network("vpc-" + i, NetworkArgs.builder()            
                .cidrBlock(var_.vpc_cidr())
                .build());

        
}
        for (var i = 0; i < (var_.security_group_id() == "" ? 1 : 0 == true); i++) {
            new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()            
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        for (var i = 0; i < (var_.vswitch_id() == "" ? 1 : 0 == true); i++) {
            new Switch("vswitch-" + i, SwitchArgs.builder()            
                .availabilityZone(var_.availability_zone() == "" ? defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : var_.availability_zone())
                .vswitchName(var_.vswitch_name())
                .cidrBlock(var_.vswitch_cidr())
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        var defaultRole = new Role("defaultRole", RoleArgs.builder()        
            .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()        
            .emrVer(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].emrVersion()))
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .hostGroups(            
                ClusterHostGroupArgs.builder()
                    .hostGroupName("master_group")
                    .hostGroupType("MASTER")
                    .nodeCount("2")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("1")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build(),
                ClusterHostGroupArgs.builder()
                    .hostGroupName("core_group")
                    .hostGroupType("CORE")
                    .nodeCount("3")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("4")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build(),
                ClusterHostGroupArgs.builder()
                    .hostGroupName("task_group")
                    .hostGroupType("TASK")
                    .nodeCount("2")
                    .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                    .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .diskCount("4")
                    .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                    .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                    .build())
            .highAvailabilityEnable(true)
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .securityGroupId(var_.security_group_id() == "" ? defaultSecurityGroup.id() : var_.security_group_id())
            .isOpenPublicIp(true)
            .chargeType("PostPaid")
            .vswitchId(var_.vswitch_id() == "" ? vswitch.id() : var_.vswitch_id())
            .userDefinedEmrEcsRole(defaultRole.name())
            .sshEnable(true)
            .masterPwd("ABCtest1234!")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default_main_versions = alicloud.emr.get_main_versions()
default_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    support_local_storage=False,
    instance_charge_type="PostPaid",
    support_node_types=[
        "MASTER",
        "CORE",
        "TASK",
    ])
data_disk = alicloud.emr.get_disk_types(destination_resource="DataDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
vpc = []
for range in [{"value": i} for i in range(0, 1 if var.vpc_id ==  else 0 == True)]:
    vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}", cidr_block=var["vpc_cidr"]))
default_security_group = []
for range in [{"value": i} for i in range(0, 1 if var.security_group_id ==  else 0 == True)]:
    default_security_group.append(alicloud.ecs.SecurityGroup(f"defaultSecurityGroup-{range['value']}", vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# VSwitch Resource for Module
vswitch = []
for range in [{"value": i} for i in range(0, 1 if var.vswitch_id ==  else 0 == True)]:
    vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
        availability_zone=default_instance_types.types[0].zone_id if var["availability_zone"] == "" else var["availability_zone"],
        vswitch_name=var["vswitch_name"],
        cidr_block=var["vswitch_cidr"],
        vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# Ram role Resource for Module
default_role = alicloud.ram.Role("defaultRole",
    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.emr.Cluster("defaultCluster",
    emr_ver=default_main_versions.main_versions[0].emr_version,
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    host_groups=[
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="master_group",
            host_group_type="MASTER",
            node_count="2",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="1",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="core_group",
            host_group_type="CORE",
            node_count="3",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="4",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
        alicloud.emr.ClusterHostGroupArgs(
            host_group_name="task_group",
            host_group_type="TASK",
            node_count="2",
            instance_type=default_instance_types.types[0].id,
            disk_type=data_disk.types[0].value,
            disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
            disk_count="4",
            sys_disk_type=system_disk.types[0].value,
            sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
        ),
    ],
    high_availability_enable=True,
    zone_id=default_instance_types.types[0].zone_id,
    security_group_id=default_security_group.id if var["security_group_id"] == "" else var["security_group_id"],
    is_open_public_ip=True,
    charge_type="PostPaid",
    vswitch_id=vswitch.id if var["vswitch_id"] == "" else var["vswitch_id"],
    user_defined_emr_ecs_role=default_role.name,
    ssh_enable=True,
    master_pwd="ABCtest1234!")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultMainVersions = alicloud.emr.getMainVersions({});
const defaultInstanceTypes = defaultMainVersions.then(defaultMainVersions => alicloud.emr.getInstanceTypes({
    destinationResource: "InstanceType",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    supportLocalStorage: false,
    instanceChargeType: "PostPaid",
    supportNodeTypes: [
        "MASTER",
        "CORE",
        "TASK",
    ],
}));
const dataDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "DataDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const systemDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "SystemDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const vpc: alicloud.vpc.Network[] = [];
for (const range = {value: 0}; range.value < (_var.vpc_id == "" ? 1 : 0 == true); range.value++) {
    vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {cidrBlock: _var.vpc_cidr}));
}
const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
for (const range = {value: 0}; range.value < (_var.security_group_id == "" ? 1 : 0 == true); range.value++) {
    defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`defaultSecurityGroup-${range.value}`, {vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id}));
}
// VSwitch Resource for Module
const vswitch: alicloud.vpc.Switch[] = [];
for (const range = {value: 0}; range.value < (_var.vswitch_id == "" ? 1 : 0 == true); range.value++) {
    vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
        availabilityZone: _var.availability_zone == "" ? defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId) : _var.availability_zone,
        vswitchName: _var.vswitch_name,
        cidrBlock: _var.vswitch_cidr,
        vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id,
    }));
}
// Ram role Resource for Module
const defaultRole = new alicloud.ram.Role("defaultRole", {
    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.emr.Cluster("defaultCluster", {
    emrVer: defaultMainVersions.then(defaultMainVersions => defaultMainVersions.mainVersions?.[0]?.emrVersion),
    clusterType: defaultMainVersions.then(defaultMainVersions => defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0]),
    hostGroups: [
        {
            hostGroupName: "master_group",
            hostGroupType: "MASTER",
            nodeCount: "2",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "1",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
        {
            hostGroupName: "core_group",
            hostGroupType: "CORE",
            nodeCount: "3",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "4",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
        {
            hostGroupName: "task_group",
            hostGroupType: "TASK",
            nodeCount: "2",
            instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
            diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
            diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
            diskCount: "4",
            sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
            sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
        },
    ],
    highAvailabilityEnable: true,
    zoneId: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId),
    securityGroupId: _var.security_group_id == "" ? defaultSecurityGroup.id : _var.security_group_id,
    isOpenPublicIp: true,
    chargeType: "PostPaid",
    vswitchId: _var.vswitch_id == "" ? vswitch.id : _var.vswitch_id,
    userDefinedEmrEcsRole: defaultRole.name,
    sshEnable: true,
    masterPwd: "ABCtest1234!",
});

Coming soon!

4. Create a emr gateway cluster

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var defaultMainVersions = AliCloud.Emr.GetMainVersions.Invoke();

    var defaultInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
    {
        DestinationResource = "InstanceType",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        SupportLocalStorage = false,
        InstanceChargeType = "PostPaid",
        SupportNodeTypes = new[]
        {
            "GATEWAY",
        },
    });

    var dataDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "DataDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
    {
        DestinationResource = "SystemDisk",
        ClusterType = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
        InstanceChargeType = "PostPaid",
        InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
    });

    var vpc = new List<AliCloud.Vpc.Network>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vpc_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
        {
            CidrBlock = @var.Vpc_cidr,
        }));
    }
    var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
    for (var rangeIndex = 0; rangeIndex < (@var.Security_group_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"defaultSecurityGroup-{range.Value}", new()
        {
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // VSwitch Resource for Module
    var vswitch = new List<AliCloud.Vpc.Switch>();
    for (var rangeIndex = 0; rangeIndex < (@var.Vswitch_id == "" ? 1 : 0 == true); rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
        {
            AvailabilityZone = @var.Availability_zone == "" ? defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : @var.Availability_zone,
            VswitchName = @var.Vswitch_name,
            CidrBlock = @var.Vswitch_cidr,
            VpcId = @var.Vpc_id == "" ? vpc.Id : @var.Vpc_id,
        }));
    }
    // Ram role Resource for Module
    var defaultRole = new AliCloud.Ram.Role("defaultRole", new()
    {
        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 gateway = new AliCloud.Emr.Cluster("gateway", new()
    {
        EmrVer = defaultMainVersions.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion),
        ClusterType = "GATEWAY",
        HostGroups = new[]
        {
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                HostGroupName = "master_group",
                HostGroupType = "GATEWAY",
                NodeCount = "1",
                InstanceType = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                DiskCapacity = Output.Tuple(dataDisk.Apply(getDiskTypesResult => getDiskTypesResult), dataDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var dataDisk = values.Item1;
                    var dataDisk1 = values.Item2;
                    return dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? dataDisk1.Types[0]?.Min : 160;
                }),
                DiskCount = "1",
                SysDiskType = systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                SysDiskCapacity = Output.Tuple(systemDisk.Apply(getDiskTypesResult => getDiskTypesResult), systemDisk.Apply(getDiskTypesResult => getDiskTypesResult)).Apply(values =>
                {
                    var systemDisk = values.Item1;
                    var systemDisk1 = values.Item2;
                    return systemDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Min) > 160 ? systemDisk1.Types[0]?.Min : 160;
                }),
            },
        },
        HighAvailabilityEnable = true,
        ZoneId = defaultInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        SecurityGroupId = @var.Security_group_id == "" ? defaultSecurityGroup.Id : @var.Security_group_id,
        IsOpenPublicIp = true,
        ChargeType = "PostPaid",
        VswitchId = @var.Vswitch_id == "" ? vswitch.Id : @var.Vswitch_id,
        UserDefinedEmrEcsRole = defaultRole.Name,
        SshEnable = true,
        MasterPwd = "ABCtest1234!",
        RelatedClusterId = related_cluster_id,
    });

});

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.emr.EmrFunctions;
import com.pulumi.alicloud.emr.inputs.GetMainVersionsArgs;
import com.pulumi.alicloud.emr.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.emr.inputs.GetDiskTypesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ram.Role;
import com.pulumi.alicloud.ram.RoleArgs;
import com.pulumi.alicloud.emr.Cluster;
import com.pulumi.alicloud.emr.ClusterArgs;
import com.pulumi.alicloud.emr.inputs.ClusterHostGroupArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 defaultMainVersions = EmrFunctions.getMainVersions();

        final var defaultInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
            .destinationResource("InstanceType")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .supportLocalStorage(false)
            .instanceChargeType("PostPaid")
            .supportNodeTypes("GATEWAY")
            .build());

        final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("DataDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
            .destinationResource("SystemDisk")
            .clusterType(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].clusterTypes()[0]))
            .instanceChargeType("PostPaid")
            .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .build());

        for (var i = 0; i < (var_.vpc_id() == "" ? 1 : 0 == true); i++) {
            new Network("vpc-" + i, NetworkArgs.builder()            
                .cidrBlock(var_.vpc_cidr())
                .build());

        
}
        for (var i = 0; i < (var_.security_group_id() == "" ? 1 : 0 == true); i++) {
            new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()            
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        for (var i = 0; i < (var_.vswitch_id() == "" ? 1 : 0 == true); i++) {
            new Switch("vswitch-" + i, SwitchArgs.builder()            
                .availabilityZone(var_.availability_zone() == "" ? defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : var_.availability_zone())
                .vswitchName(var_.vswitch_name())
                .cidrBlock(var_.vswitch_cidr())
                .vpcId(var_.vpc_id() == "" ? vpc.id() : var_.vpc_id())
                .build());

        
}
        var defaultRole = new Role("defaultRole", RoleArgs.builder()        
            .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 gateway = new Cluster("gateway", ClusterArgs.builder()        
            .emrVer(defaultMainVersions.applyValue(getMainVersionsResult -> getMainVersionsResult.mainVersions()[0].emrVersion()))
            .clusterType("GATEWAY")
            .hostGroups(ClusterHostGroupArgs.builder()
                .hostGroupName("master_group")
                .hostGroupType("GATEWAY")
                .nodeCount("1")
                .instanceType(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .diskType(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                .diskCapacity(dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? dataDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                .diskCount("1")
                .sysDiskType(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].value()))
                .sysDiskCapacity(systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) > 160 ? systemDisk.applyValue(getDiskTypesResult -> getDiskTypesResult.types()[0].min()) : 160)
                .build())
            .highAvailabilityEnable(true)
            .zoneId(defaultInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
            .securityGroupId(var_.security_group_id() == "" ? defaultSecurityGroup.id() : var_.security_group_id())
            .isOpenPublicIp(true)
            .chargeType("PostPaid")
            .vswitchId(var_.vswitch_id() == "" ? vswitch.id() : var_.vswitch_id())
            .userDefinedEmrEcsRole(defaultRole.name())
            .sshEnable(true)
            .masterPwd("ABCtest1234!")
            .relatedClusterId(related_cluster_id)
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default_main_versions = alicloud.emr.get_main_versions()
default_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    support_local_storage=False,
    instance_charge_type="PostPaid",
    support_node_types=["GATEWAY"])
data_disk = alicloud.emr.get_disk_types(destination_resource="DataDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
    cluster_type=default_main_versions.main_versions[0].cluster_types[0],
    instance_charge_type="PostPaid",
    instance_type=default_instance_types.types[0].id,
    zone_id=default_instance_types.types[0].zone_id)
vpc = []
for range in [{"value": i} for i in range(0, 1 if var.vpc_id ==  else 0 == True)]:
    vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}", cidr_block=var["vpc_cidr"]))
default_security_group = []
for range in [{"value": i} for i in range(0, 1 if var.security_group_id ==  else 0 == True)]:
    default_security_group.append(alicloud.ecs.SecurityGroup(f"defaultSecurityGroup-{range['value']}", vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# VSwitch Resource for Module
vswitch = []
for range in [{"value": i} for i in range(0, 1 if var.vswitch_id ==  else 0 == True)]:
    vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
        availability_zone=default_instance_types.types[0].zone_id if var["availability_zone"] == "" else var["availability_zone"],
        vswitch_name=var["vswitch_name"],
        cidr_block=var["vswitch_cidr"],
        vpc_id=vpc.id if var["vpc_id"] == "" else var["vpc_id"]))
# Ram role Resource for Module
default_role = alicloud.ram.Role("defaultRole",
    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)
gateway = alicloud.emr.Cluster("gateway",
    emr_ver=default_main_versions.main_versions[0].emr_version,
    cluster_type="GATEWAY",
    host_groups=[alicloud.emr.ClusterHostGroupArgs(
        host_group_name="master_group",
        host_group_type="GATEWAY",
        node_count="1",
        instance_type=default_instance_types.types[0].id,
        disk_type=data_disk.types[0].value,
        disk_capacity=data_disk.types[0].min if data_disk.types[0].min > 160 else "160",
        disk_count="1",
        sys_disk_type=system_disk.types[0].value,
        sys_disk_capacity=system_disk.types[0].min if system_disk.types[0].min > 160 else "160",
    )],
    high_availability_enable=True,
    zone_id=default_instance_types.types[0].zone_id,
    security_group_id=default_security_group.id if var["security_group_id"] == "" else var["security_group_id"],
    is_open_public_ip=True,
    charge_type="PostPaid",
    vswitch_id=vswitch.id if var["vswitch_id"] == "" else var["vswitch_id"],
    user_defined_emr_ecs_role=default_role.name,
    ssh_enable=True,
    master_pwd="ABCtest1234!",
    related_cluster_id=related_cluster_id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultMainVersions = alicloud.emr.getMainVersions({});
const defaultInstanceTypes = defaultMainVersions.then(defaultMainVersions => alicloud.emr.getInstanceTypes({
    destinationResource: "InstanceType",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    supportLocalStorage: false,
    instanceChargeType: "PostPaid",
    supportNodeTypes: ["GATEWAY"],
}));
const dataDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "DataDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const systemDisk = Promise.all([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes]).then(([defaultMainVersions, defaultInstanceTypes, defaultInstanceTypes1]) => alicloud.emr.getDiskTypes({
    destinationResource: "SystemDisk",
    clusterType: defaultMainVersions.mainVersions?.[0]?.clusterTypes?.[0],
    instanceChargeType: "PostPaid",
    instanceType: defaultInstanceTypes.types?.[0]?.id,
    zoneId: defaultInstanceTypes1.types?.[0]?.zoneId,
}));
const vpc: alicloud.vpc.Network[] = [];
for (const range = {value: 0}; range.value < (_var.vpc_id == "" ? 1 : 0 == true); range.value++) {
    vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {cidrBlock: _var.vpc_cidr}));
}
const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
for (const range = {value: 0}; range.value < (_var.security_group_id == "" ? 1 : 0 == true); range.value++) {
    defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`defaultSecurityGroup-${range.value}`, {vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id}));
}
// VSwitch Resource for Module
const vswitch: alicloud.vpc.Switch[] = [];
for (const range = {value: 0}; range.value < (_var.vswitch_id == "" ? 1 : 0 == true); range.value++) {
    vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
        availabilityZone: _var.availability_zone == "" ? defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId) : _var.availability_zone,
        vswitchName: _var.vswitch_name,
        cidrBlock: _var.vswitch_cidr,
        vpcId: _var.vpc_id == "" ? vpc.id : _var.vpc_id,
    }));
}
// Ram role Resource for Module
const defaultRole = new alicloud.ram.Role("defaultRole", {
    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 gateway = new alicloud.emr.Cluster("gateway", {
    emrVer: defaultMainVersions.then(defaultMainVersions => defaultMainVersions.mainVersions?.[0]?.emrVersion),
    clusterType: "GATEWAY",
    hostGroups: [{
        hostGroupName: "master_group",
        hostGroupType: "GATEWAY",
        nodeCount: "1",
        instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.id),
        diskType: dataDisk.then(dataDisk => dataDisk.types?.[0]?.value),
        diskCapacity: Promise.all([dataDisk, dataDisk]).then(([dataDisk, dataDisk1]) => dataDisk.types?.[0]?.min > 160 ? dataDisk1.types?.[0]?.min : 160),
        diskCount: "1",
        sysDiskType: systemDisk.then(systemDisk => systemDisk.types?.[0]?.value),
        sysDiskCapacity: Promise.all([systemDisk, systemDisk]).then(([systemDisk, systemDisk1]) => systemDisk.types?.[0]?.min > 160 ? systemDisk1.types?.[0]?.min : 160),
    }],
    highAvailabilityEnable: true,
    zoneId: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.types?.[0]?.zoneId),
    securityGroupId: _var.security_group_id == "" ? defaultSecurityGroup.id : _var.security_group_id,
    isOpenPublicIp: true,
    chargeType: "PostPaid",
    vswitchId: _var.vswitch_id == "" ? vswitch.id : _var.vswitch_id,
    userDefinedEmrEcsRole: defaultRole.name,
    sshEnable: true,
    masterPwd: "ABCtest1234!",
    relatedClusterId: related_cluster_id,
});

Coming soon!

Create Cluster Resource

new Cluster(name: string, args: ClusterArgs, opts?: CustomResourceOptions);
@overload
def Cluster(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            bootstrap_actions: Optional[Sequence[ClusterBootstrapActionArgs]] = None,
            charge_type: Optional[str] = None,
            cluster_type: Optional[str] = None,
            configs: Optional[Sequence[ClusterConfigArgs]] = None,
            deposit_type: Optional[str] = None,
            eas_enable: Optional[bool] = None,
            emr_ver: Optional[str] = None,
            high_availability_enable: Optional[bool] = None,
            host_groups: Optional[Sequence[ClusterHostGroupArgs]] = None,
            is_open_public_ip: Optional[bool] = None,
            key_pair_name: Optional[str] = None,
            master_pwd: Optional[str] = None,
            meta_store_conf: Optional[ClusterMetaStoreConfArgs] = None,
            meta_store_type: Optional[str] = None,
            modify_cluster_service_config: Optional[ClusterModifyClusterServiceConfigArgs] = None,
            name: Optional[str] = None,
            option_software_lists: Optional[Sequence[str]] = None,
            period: Optional[int] = None,
            related_cluster_id: Optional[str] = None,
            resource_group_id: Optional[str] = None,
            security_group_id: Optional[str] = None,
            ssh_enable: Optional[bool] = None,
            tags: Optional[Mapping[str, Any]] = None,
            use_local_metadb: Optional[bool] = None,
            user_defined_emr_ecs_role: Optional[str] = None,
            vswitch_id: Optional[str] = None,
            zone_id: Optional[str] = None)
@overload
def Cluster(resource_name: str,
            args: ClusterArgs,
            opts: Optional[ResourceOptions] = None)
func NewCluster(ctx *Context, name string, args ClusterArgs, opts ...ResourceOption) (*Cluster, error)
public Cluster(string name, ClusterArgs args, CustomResourceOptions? opts = null)
public Cluster(String name, ClusterArgs args)
public Cluster(String name, ClusterArgs args, CustomResourceOptions options)
type: alicloud:emr:Cluster
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ClusterArgs
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 ClusterArgs
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 ClusterArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ClusterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ClusterArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

ClusterType string

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

EmrVer string

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

ZoneId string

Zone ID, e.g. cn-huhehaote-a

BootstrapActions List<Pulumi.AliCloud.Emr.Inputs.ClusterBootstrapActionArgs>

Boot action parameters.

ChargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

Configs List<Pulumi.AliCloud.Emr.Inputs.ClusterConfigArgs>

The custom configurations of emr-cluster service.

DepositType string

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

EasEnable bool

High security cluster (true) or not. Default value is false.

HighAvailabilityEnable bool

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

HostGroups List<Pulumi.AliCloud.Emr.Inputs.ClusterHostGroupArgs>

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

IsOpenPublicIp bool

Whether the MASTER node has a public IP address enabled. Default value is false.

KeyPairName string

Ssh key pair.

MasterPwd string

Master ssh password.

MetaStoreConf Pulumi.AliCloud.Emr.Inputs.ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

MetaStoreType string

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

ModifyClusterServiceConfig Pulumi.AliCloud.Emr.Inputs.ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

Name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

OptionSoftwareLists List<string>

Optional software list.

Period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

RelatedClusterId string

This specify the related cluster id, if this cluster is a Gateway.

ResourceGroupId string

The Id of resource group which the emr-cluster belongs.

SecurityGroupId string

Security Group ID for Cluster, you can also specify this key for each host group.

SshEnable bool

If this is set true, we can ssh into cluster. Default value is false.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

UseLocalMetadb bool

Use local metadb. Default is false.

UserDefinedEmrEcsRole string

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

VswitchId string

Global vswitch id, you can also specify it in host group.

ClusterType string

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

EmrVer string

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

ZoneId string

Zone ID, e.g. cn-huhehaote-a

BootstrapActions []ClusterBootstrapActionArgs

Boot action parameters.

ChargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

Configs []ClusterConfigArgs

The custom configurations of emr-cluster service.

DepositType string

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

EasEnable bool

High security cluster (true) or not. Default value is false.

HighAvailabilityEnable bool

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

HostGroups []ClusterHostGroupArgs

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

IsOpenPublicIp bool

Whether the MASTER node has a public IP address enabled. Default value is false.

KeyPairName string

Ssh key pair.

MasterPwd string

Master ssh password.

MetaStoreConf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

MetaStoreType string

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

ModifyClusterServiceConfig ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

Name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

OptionSoftwareLists []string

Optional software list.

Period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

RelatedClusterId string

This specify the related cluster id, if this cluster is a Gateway.

ResourceGroupId string

The Id of resource group which the emr-cluster belongs.

SecurityGroupId string

Security Group ID for Cluster, you can also specify this key for each host group.

SshEnable bool

If this is set true, we can ssh into cluster. Default value is false.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

UseLocalMetadb bool

Use local metadb. Default is false.

UserDefinedEmrEcsRole string

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

VswitchId string

Global vswitch id, you can also specify it in host group.

clusterType String

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

emrVer String

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

zoneId String

Zone ID, e.g. cn-huhehaote-a

bootstrapActions List<ClusterBootstrapActionArgs>

Boot action parameters.

chargeType String

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

configs List<ClusterConfigArgs>

The custom configurations of emr-cluster service.

depositType String

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

easEnable Boolean

High security cluster (true) or not. Default value is false.

highAvailabilityEnable Boolean

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

hostGroups List<ClusterHostGroupArgs>

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

isOpenPublicIp Boolean

Whether the MASTER node has a public IP address enabled. Default value is false.

keyPairName String

Ssh key pair.

masterPwd String

Master ssh password.

metaStoreConf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

metaStoreType String

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modifyClusterServiceConfig ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

name String

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

optionSoftwareLists List<String>

Optional software list.

period Integer

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

relatedClusterId String

This specify the related cluster id, if this cluster is a Gateway.

resourceGroupId String

The Id of resource group which the emr-cluster belongs.

securityGroupId String

Security Group ID for Cluster, you can also specify this key for each host group.

sshEnable Boolean

If this is set true, we can ssh into cluster. Default value is false.

tags Map<String,Object>

A mapping of tags to assign to the resource.

useLocalMetadb Boolean

Use local metadb. Default is false.

userDefinedEmrEcsRole String

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitchId String

Global vswitch id, you can also specify it in host group.

clusterType string

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

emrVer string

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

zoneId string

Zone ID, e.g. cn-huhehaote-a

bootstrapActions ClusterBootstrapActionArgs[]

Boot action parameters.

chargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

configs ClusterConfigArgs[]

The custom configurations of emr-cluster service.

depositType string

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

easEnable boolean

High security cluster (true) or not. Default value is false.

highAvailabilityEnable boolean

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

hostGroups ClusterHostGroupArgs[]

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

isOpenPublicIp boolean

Whether the MASTER node has a public IP address enabled. Default value is false.

keyPairName string

Ssh key pair.

masterPwd string

Master ssh password.

metaStoreConf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

metaStoreType string

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modifyClusterServiceConfig ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

optionSoftwareLists string[]

Optional software list.

period number

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

relatedClusterId string

This specify the related cluster id, if this cluster is a Gateway.

resourceGroupId string

The Id of resource group which the emr-cluster belongs.

securityGroupId string

Security Group ID for Cluster, you can also specify this key for each host group.

sshEnable boolean

If this is set true, we can ssh into cluster. Default value is false.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

useLocalMetadb boolean

Use local metadb. Default is false.

userDefinedEmrEcsRole string

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitchId string

Global vswitch id, you can also specify it in host group.

cluster_type str

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

emr_ver str

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

zone_id str

Zone ID, e.g. cn-huhehaote-a

bootstrap_actions Sequence[ClusterBootstrapActionArgs]

Boot action parameters.

charge_type str

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

configs Sequence[ClusterConfigArgs]

The custom configurations of emr-cluster service.

deposit_type str

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

eas_enable bool

High security cluster (true) or not. Default value is false.

high_availability_enable bool

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

host_groups Sequence[ClusterHostGroupArgs]

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

is_open_public_ip bool

Whether the MASTER node has a public IP address enabled. Default value is false.

key_pair_name str

Ssh key pair.

master_pwd str

Master ssh password.

meta_store_conf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

meta_store_type str

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modify_cluster_service_config ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

name str

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

option_software_lists Sequence[str]

Optional software list.

period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

related_cluster_id str

This specify the related cluster id, if this cluster is a Gateway.

resource_group_id str

The Id of resource group which the emr-cluster belongs.

security_group_id str

Security Group ID for Cluster, you can also specify this key for each host group.

ssh_enable bool

If this is set true, we can ssh into cluster. Default value is false.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

use_local_metadb bool

Use local metadb. Default is false.

user_defined_emr_ecs_role str

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitch_id str

Global vswitch id, you can also specify it in host group.

clusterType String

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

emrVer String

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

zoneId String

Zone ID, e.g. cn-huhehaote-a

bootstrapActions List<Property Map>

Boot action parameters.

chargeType String

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

configs List<Property Map>

The custom configurations of emr-cluster service.

depositType String

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

easEnable Boolean

High security cluster (true) or not. Default value is false.

highAvailabilityEnable Boolean

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

hostGroups List<Property Map>

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

isOpenPublicIp Boolean

Whether the MASTER node has a public IP address enabled. Default value is false.

keyPairName String

Ssh key pair.

masterPwd String

Master ssh password.

metaStoreConf Property Map

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

metaStoreType String

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modifyClusterServiceConfig Property Map

The configurations of emr-cluster service modification after cluster created.

name String

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

optionSoftwareLists List<String>

Optional software list.

period Number

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

relatedClusterId String

This specify the related cluster id, if this cluster is a Gateway.

resourceGroupId String

The Id of resource group which the emr-cluster belongs.

securityGroupId String

Security Group ID for Cluster, you can also specify this key for each host group.

sshEnable Boolean

If this is set true, we can ssh into cluster. Default value is false.

tags Map<Any>

A mapping of tags to assign to the resource.

useLocalMetadb Boolean

Use local metadb. Default is false.

userDefinedEmrEcsRole String

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitchId String

Global vswitch id, you can also specify it in host group.

Outputs

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

Get an existing Cluster 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?: ClusterState, opts?: CustomResourceOptions): Cluster
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bootstrap_actions: Optional[Sequence[ClusterBootstrapActionArgs]] = None,
        charge_type: Optional[str] = None,
        cluster_type: Optional[str] = None,
        configs: Optional[Sequence[ClusterConfigArgs]] = None,
        deposit_type: Optional[str] = None,
        eas_enable: Optional[bool] = None,
        emr_ver: Optional[str] = None,
        high_availability_enable: Optional[bool] = None,
        host_groups: Optional[Sequence[ClusterHostGroupArgs]] = None,
        is_open_public_ip: Optional[bool] = None,
        key_pair_name: Optional[str] = None,
        master_pwd: Optional[str] = None,
        meta_store_conf: Optional[ClusterMetaStoreConfArgs] = None,
        meta_store_type: Optional[str] = None,
        modify_cluster_service_config: Optional[ClusterModifyClusterServiceConfigArgs] = None,
        name: Optional[str] = None,
        option_software_lists: Optional[Sequence[str]] = None,
        period: Optional[int] = None,
        related_cluster_id: Optional[str] = None,
        resource_group_id: Optional[str] = None,
        security_group_id: Optional[str] = None,
        ssh_enable: Optional[bool] = None,
        tags: Optional[Mapping[str, Any]] = None,
        use_local_metadb: Optional[bool] = None,
        user_defined_emr_ecs_role: Optional[str] = None,
        vswitch_id: Optional[str] = None,
        zone_id: Optional[str] = None) -> Cluster
func GetCluster(ctx *Context, name string, id IDInput, state *ClusterState, opts ...ResourceOption) (*Cluster, error)
public static Cluster Get(string name, Input<string> id, ClusterState? state, CustomResourceOptions? opts = null)
public static Cluster get(String name, Output<String> id, ClusterState 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:
BootstrapActions List<Pulumi.AliCloud.Emr.Inputs.ClusterBootstrapActionArgs>

Boot action parameters.

ChargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

ClusterType string

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

Configs List<Pulumi.AliCloud.Emr.Inputs.ClusterConfigArgs>

The custom configurations of emr-cluster service.

DepositType string

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

EasEnable bool

High security cluster (true) or not. Default value is false.

EmrVer string

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

HighAvailabilityEnable bool

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

HostGroups List<Pulumi.AliCloud.Emr.Inputs.ClusterHostGroupArgs>

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

IsOpenPublicIp bool

Whether the MASTER node has a public IP address enabled. Default value is false.

KeyPairName string

Ssh key pair.

MasterPwd string

Master ssh password.

MetaStoreConf Pulumi.AliCloud.Emr.Inputs.ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

MetaStoreType string

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

ModifyClusterServiceConfig Pulumi.AliCloud.Emr.Inputs.ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

Name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

OptionSoftwareLists List<string>

Optional software list.

Period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

RelatedClusterId string

This specify the related cluster id, if this cluster is a Gateway.

ResourceGroupId string

The Id of resource group which the emr-cluster belongs.

SecurityGroupId string

Security Group ID for Cluster, you can also specify this key for each host group.

SshEnable bool

If this is set true, we can ssh into cluster. Default value is false.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

UseLocalMetadb bool

Use local metadb. Default is false.

UserDefinedEmrEcsRole string

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

VswitchId string

Global vswitch id, you can also specify it in host group.

ZoneId string

Zone ID, e.g. cn-huhehaote-a

BootstrapActions []ClusterBootstrapActionArgs

Boot action parameters.

ChargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

ClusterType string

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

Configs []ClusterConfigArgs

The custom configurations of emr-cluster service.

DepositType string

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

EasEnable bool

High security cluster (true) or not. Default value is false.

EmrVer string

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

HighAvailabilityEnable bool

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

HostGroups []ClusterHostGroupArgs

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

IsOpenPublicIp bool

Whether the MASTER node has a public IP address enabled. Default value is false.

KeyPairName string

Ssh key pair.

MasterPwd string

Master ssh password.

MetaStoreConf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

MetaStoreType string

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

ModifyClusterServiceConfig ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

Name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

OptionSoftwareLists []string

Optional software list.

Period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

RelatedClusterId string

This specify the related cluster id, if this cluster is a Gateway.

ResourceGroupId string

The Id of resource group which the emr-cluster belongs.

SecurityGroupId string

Security Group ID for Cluster, you can also specify this key for each host group.

SshEnable bool

If this is set true, we can ssh into cluster. Default value is false.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

UseLocalMetadb bool

Use local metadb. Default is false.

UserDefinedEmrEcsRole string

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

VswitchId string

Global vswitch id, you can also specify it in host group.

ZoneId string

Zone ID, e.g. cn-huhehaote-a

bootstrapActions List<ClusterBootstrapActionArgs>

Boot action parameters.

chargeType String

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

clusterType String

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

configs List<ClusterConfigArgs>

The custom configurations of emr-cluster service.

depositType String

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

easEnable Boolean

High security cluster (true) or not. Default value is false.

emrVer String

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

highAvailabilityEnable Boolean

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

hostGroups List<ClusterHostGroupArgs>

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

isOpenPublicIp Boolean

Whether the MASTER node has a public IP address enabled. Default value is false.

keyPairName String

Ssh key pair.

masterPwd String

Master ssh password.

metaStoreConf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

metaStoreType String

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modifyClusterServiceConfig ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

name String

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

optionSoftwareLists List<String>

Optional software list.

period Integer

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

relatedClusterId String

This specify the related cluster id, if this cluster is a Gateway.

resourceGroupId String

The Id of resource group which the emr-cluster belongs.

securityGroupId String

Security Group ID for Cluster, you can also specify this key for each host group.

sshEnable Boolean

If this is set true, we can ssh into cluster. Default value is false.

tags Map<String,Object>

A mapping of tags to assign to the resource.

useLocalMetadb Boolean

Use local metadb. Default is false.

userDefinedEmrEcsRole String

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitchId String

Global vswitch id, you can also specify it in host group.

zoneId String

Zone ID, e.g. cn-huhehaote-a

bootstrapActions ClusterBootstrapActionArgs[]

Boot action parameters.

chargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

clusterType string

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

configs ClusterConfigArgs[]

The custom configurations of emr-cluster service.

depositType string

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

easEnable boolean

High security cluster (true) or not. Default value is false.

emrVer string

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

highAvailabilityEnable boolean

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

hostGroups ClusterHostGroupArgs[]

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

isOpenPublicIp boolean

Whether the MASTER node has a public IP address enabled. Default value is false.

keyPairName string

Ssh key pair.

masterPwd string

Master ssh password.

metaStoreConf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

metaStoreType string

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modifyClusterServiceConfig ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

optionSoftwareLists string[]

Optional software list.

period number

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

relatedClusterId string

This specify the related cluster id, if this cluster is a Gateway.

resourceGroupId string

The Id of resource group which the emr-cluster belongs.

securityGroupId string

Security Group ID for Cluster, you can also specify this key for each host group.

sshEnable boolean

If this is set true, we can ssh into cluster. Default value is false.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

useLocalMetadb boolean

Use local metadb. Default is false.

userDefinedEmrEcsRole string

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitchId string

Global vswitch id, you can also specify it in host group.

zoneId string

Zone ID, e.g. cn-huhehaote-a

bootstrap_actions Sequence[ClusterBootstrapActionArgs]

Boot action parameters.

charge_type str

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

cluster_type str

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

configs Sequence[ClusterConfigArgs]

The custom configurations of emr-cluster service.

deposit_type str

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

eas_enable bool

High security cluster (true) or not. Default value is false.

emr_ver str

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

high_availability_enable bool

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

host_groups Sequence[ClusterHostGroupArgs]

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

is_open_public_ip bool

Whether the MASTER node has a public IP address enabled. Default value is false.

key_pair_name str

Ssh key pair.

master_pwd str

Master ssh password.

meta_store_conf ClusterMetaStoreConfArgs

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

meta_store_type str

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modify_cluster_service_config ClusterModifyClusterServiceConfigArgs

The configurations of emr-cluster service modification after cluster created.

name str

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

option_software_lists Sequence[str]

Optional software list.

period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

related_cluster_id str

This specify the related cluster id, if this cluster is a Gateway.

resource_group_id str

The Id of resource group which the emr-cluster belongs.

security_group_id str

Security Group ID for Cluster, you can also specify this key for each host group.

ssh_enable bool

If this is set true, we can ssh into cluster. Default value is false.

tags Mapping[str, Any]

A mapping of tags to assign to the resource.

use_local_metadb bool

Use local metadb. Default is false.

user_defined_emr_ecs_role str

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitch_id str

Global vswitch id, you can also specify it in host group.

zone_id str

Zone ID, e.g. cn-huhehaote-a

bootstrapActions List<Property Map>

Boot action parameters.

chargeType String

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

clusterType String

EMR Cluster Type, e.g. HADOOP, KAFKA, DRUID, GATEWAY etc. You can find all valid EMR cluster type in emr web console. Supported 'GATEWAY' available in 1.61.0+.

configs List<Property Map>

The custom configurations of emr-cluster service.

depositType String

Cluster deposit type, HALF_MANAGED or FULL_MANAGED.

easEnable Boolean

High security cluster (true) or not. Default value is false.

emrVer String

EMR Version, e.g. EMR-3.22.0. You can find the all valid EMR Version in emr web console.

highAvailabilityEnable Boolean

High Available for HDFS and YARN. If this is set true, MASTER group must have two nodes.

hostGroups List<Property Map>

Groups of Host, You can specify MASTER as a group, CORE as a group (just like the above example).

isOpenPublicIp Boolean

Whether the MASTER node has a public IP address enabled. Default value is false.

keyPairName String

Ssh key pair.

masterPwd String

Master ssh password.

metaStoreConf Property Map

The configuration of emr-cluster service component metadata storage. If meta store type is ’user_rds’, this should be specified.

metaStoreType String

The type of emr-cluster service component metadata storage. ’dlf’ or ’local’ or ’user_rds’ .

modifyClusterServiceConfig Property Map

The configurations of emr-cluster service modification after cluster created.

name String

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

optionSoftwareLists List<String>

Optional software list.

period Number

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

relatedClusterId String

This specify the related cluster id, if this cluster is a Gateway.

resourceGroupId String

The Id of resource group which the emr-cluster belongs.

securityGroupId String

Security Group ID for Cluster, you can also specify this key for each host group.

sshEnable Boolean

If this is set true, we can ssh into cluster. Default value is false.

tags Map<Any>

A mapping of tags to assign to the resource.

useLocalMetadb Boolean

Use local metadb. Default is false.

userDefinedEmrEcsRole String

Alicloud EMR uses roles to perform actions on your behalf when provisioning cluster resources, running applications, dynamically scaling resources. EMR uses the following roles when interacting with other Alicloud services. Default value is AliyunEmrEcsDefaultRole.

vswitchId String

Global vswitch id, you can also specify it in host group.

zoneId String

Zone ID, e.g. cn-huhehaote-a

Supporting Types

ClusterBootstrapAction

Arg string

bootstrap action args, e.g. "--a=b".

ExecutionFailStrategy string

bootstrap action execution fail strategy, ’FAILED_BLOCKED’ or ‘FAILED_CONTINUE’ . Default value: "FAILED_BLOCKED

ExecutionMoment string

bootstrap action execution moment, ’BEFORE_INSTALL’ or ‘AFTER_STARTED’ . Default value: "BEFORE_INSTALL".

ExecutionTarget string

bootstrap action execution target, you can specify the host group name, e.g. "core_group". If this is not specified, the bootstrap action execution target is whole cluster.

Name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

Path string

bootstrap action path, e.g. "oss://bucket/path".

Arg string

bootstrap action args, e.g. "--a=b".

ExecutionFailStrategy string

bootstrap action execution fail strategy, ’FAILED_BLOCKED’ or ‘FAILED_CONTINUE’ . Default value: "FAILED_BLOCKED

ExecutionMoment string

bootstrap action execution moment, ’BEFORE_INSTALL’ or ‘AFTER_STARTED’ . Default value: "BEFORE_INSTALL".

ExecutionTarget string

bootstrap action execution target, you can specify the host group name, e.g. "core_group". If this is not specified, the bootstrap action execution target is whole cluster.

Name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

Path string

bootstrap action path, e.g. "oss://bucket/path".

arg String

bootstrap action args, e.g. "--a=b".

executionFailStrategy String

bootstrap action execution fail strategy, ’FAILED_BLOCKED’ or ‘FAILED_CONTINUE’ . Default value: "FAILED_BLOCKED

executionMoment String

bootstrap action execution moment, ’BEFORE_INSTALL’ or ‘AFTER_STARTED’ . Default value: "BEFORE_INSTALL".

executionTarget String

bootstrap action execution target, you can specify the host group name, e.g. "core_group". If this is not specified, the bootstrap action execution target is whole cluster.

name String

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

path String

bootstrap action path, e.g. "oss://bucket/path".

arg string

bootstrap action args, e.g. "--a=b".

executionFailStrategy string

bootstrap action execution fail strategy, ’FAILED_BLOCKED’ or ‘FAILED_CONTINUE’ . Default value: "FAILED_BLOCKED

executionMoment string

bootstrap action execution moment, ’BEFORE_INSTALL’ or ‘AFTER_STARTED’ . Default value: "BEFORE_INSTALL".

executionTarget string

bootstrap action execution target, you can specify the host group name, e.g. "core_group". If this is not specified, the bootstrap action execution target is whole cluster.

name string

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

path string

bootstrap action path, e.g. "oss://bucket/path".

arg str

bootstrap action args, e.g. "--a=b".

execution_fail_strategy str

bootstrap action execution fail strategy, ’FAILED_BLOCKED’ or ‘FAILED_CONTINUE’ . Default value: "FAILED_BLOCKED

execution_moment str

bootstrap action execution moment, ’BEFORE_INSTALL’ or ‘AFTER_STARTED’ . Default value: "BEFORE_INSTALL".

execution_target str

bootstrap action execution target, you can specify the host group name, e.g. "core_group". If this is not specified, the bootstrap action execution target is whole cluster.

name str

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

path str

bootstrap action path, e.g. "oss://bucket/path".

arg String

bootstrap action args, e.g. "--a=b".

executionFailStrategy String

bootstrap action execution fail strategy, ’FAILED_BLOCKED’ or ‘FAILED_CONTINUE’ . Default value: "FAILED_BLOCKED

executionMoment String

bootstrap action execution moment, ’BEFORE_INSTALL’ or ‘AFTER_STARTED’ . Default value: "BEFORE_INSTALL".

executionTarget String

bootstrap action execution target, you can specify the host group name, e.g. "core_group". If this is not specified, the bootstrap action execution target is whole cluster.

name String

The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".

path String

bootstrap action path, e.g. "oss://bucket/path".

ClusterConfig

ConfigKey string

Custom configuration service config key, e.g. ’dfs.replication’.

ConfigValue string

Custom configuration service config value, e.g. ’3’.

FileName string

Custom configuration service file name, e.g. ’hdfs-site’.

ServiceName string

Custom configuration service name, e.g. ’HDFS’.

ConfigKey string

Custom configuration service config key, e.g. ’dfs.replication’.

ConfigValue string

Custom configuration service config value, e.g. ’3’.

FileName string

Custom configuration service file name, e.g. ’hdfs-site’.

ServiceName string

Custom configuration service name, e.g. ’HDFS’.

configKey String

Custom configuration service config key, e.g. ’dfs.replication’.

configValue String

Custom configuration service config value, e.g. ’3’.

fileName String

Custom configuration service file name, e.g. ’hdfs-site’.

serviceName String

Custom configuration service name, e.g. ’HDFS’.

configKey string

Custom configuration service config key, e.g. ’dfs.replication’.

configValue string

Custom configuration service config value, e.g. ’3’.

fileName string

Custom configuration service file name, e.g. ’hdfs-site’.

serviceName string

Custom configuration service name, e.g. ’HDFS’.

config_key str

Custom configuration service config key, e.g. ’dfs.replication’.

config_value str

Custom configuration service config value, e.g. ’3’.

file_name str

Custom configuration service file name, e.g. ’hdfs-site’.

service_name str

Custom configuration service name, e.g. ’HDFS’.

configKey String

Custom configuration service config key, e.g. ’dfs.replication’.

configValue String

Custom configuration service config value, e.g. ’3’.

fileName String

Custom configuration service file name, e.g. ’hdfs-site’.

serviceName String

Custom configuration service name, e.g. ’HDFS’.

ClusterHostGroup

AutoRenew bool

Auto renew for prepaid, ’true’ or ‘false’ . Default value: false.

ChargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

DecommissionTimeout int

Graceful decommission timeout, unit: seconds.

DiskCapacity string

Data disk capacity.

DiskCount string

Data disk count.

DiskType string

Data disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,local_disk,cloud_essd.

EnableGracefulDecommission bool

Enable hadoop cluster of task node graceful decommission, ’true’ or ‘false’ . Default value: false.

GpuDriver string
HostGroupName string

host group name.

HostGroupType string

host group type, supported value: MASTER, CORE or TASK, supported 'GATEWAY' available in 1.61.0+.

InstanceList string

Instance list for cluster scale down. This value follows the json format, e.g. ["instance_id1","instance_id2"]. escape character for " is ".

InstanceType string

Host Ecs instance type.

NodeCount string

Host number in this group.

Period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

SysDiskCapacity string

System disk capacity.

SysDiskType string

System disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,cloud_essd.

AutoRenew bool

Auto renew for prepaid, ’true’ or ‘false’ . Default value: false.

ChargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

DecommissionTimeout int

Graceful decommission timeout, unit: seconds.

DiskCapacity string

Data disk capacity.

DiskCount string

Data disk count.

DiskType string

Data disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,local_disk,cloud_essd.

EnableGracefulDecommission bool

Enable hadoop cluster of task node graceful decommission, ’true’ or ‘false’ . Default value: false.

GpuDriver string
HostGroupName string

host group name.

HostGroupType string

host group type, supported value: MASTER, CORE or TASK, supported 'GATEWAY' available in 1.61.0+.

InstanceList string

Instance list for cluster scale down. This value follows the json format, e.g. ["instance_id1","instance_id2"]. escape character for " is ".

InstanceType string

Host Ecs instance type.

NodeCount string

Host number in this group.

Period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

SysDiskCapacity string

System disk capacity.

SysDiskType string

System disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,cloud_essd.

autoRenew Boolean

Auto renew for prepaid, ’true’ or ‘false’ . Default value: false.

chargeType String

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

decommissionTimeout Integer

Graceful decommission timeout, unit: seconds.

diskCapacity String

Data disk capacity.

diskCount String

Data disk count.

diskType String

Data disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,local_disk,cloud_essd.

enableGracefulDecommission Boolean

Enable hadoop cluster of task node graceful decommission, ’true’ or ‘false’ . Default value: false.

gpuDriver String
hostGroupName String

host group name.

hostGroupType String

host group type, supported value: MASTER, CORE or TASK, supported 'GATEWAY' available in 1.61.0+.

instanceList String

Instance list for cluster scale down. This value follows the json format, e.g. ["instance_id1","instance_id2"]. escape character for " is ".

instanceType String

Host Ecs instance type.

nodeCount String

Host number in this group.

period Integer

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

sysDiskCapacity String

System disk capacity.

sysDiskType String

System disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,cloud_essd.

autoRenew boolean

Auto renew for prepaid, ’true’ or ‘false’ . Default value: false.

chargeType string

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

decommissionTimeout number

Graceful decommission timeout, unit: seconds.

diskCapacity string

Data disk capacity.

diskCount string

Data disk count.

diskType string

Data disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,local_disk,cloud_essd.

enableGracefulDecommission boolean

Enable hadoop cluster of task node graceful decommission, ’true’ or ‘false’ . Default value: false.

gpuDriver string
hostGroupName string

host group name.

hostGroupType string

host group type, supported value: MASTER, CORE or TASK, supported 'GATEWAY' available in 1.61.0+.

instanceList string

Instance list for cluster scale down. This value follows the json format, e.g. ["instance_id1","instance_id2"]. escape character for " is ".

instanceType string

Host Ecs instance type.

nodeCount string

Host number in this group.

period number

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

sysDiskCapacity string

System disk capacity.

sysDiskType string

System disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,cloud_essd.

auto_renew bool

Auto renew for prepaid, ’true’ or ‘false’ . Default value: false.

charge_type str

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

decommission_timeout int

Graceful decommission timeout, unit: seconds.

disk_capacity str

Data disk capacity.

disk_count str

Data disk count.

disk_type str

Data disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,local_disk,cloud_essd.

enable_graceful_decommission bool

Enable hadoop cluster of task node graceful decommission, ’true’ or ‘false’ . Default value: false.

gpu_driver str
host_group_name str

host group name.

host_group_type str

host group type, supported value: MASTER, CORE or TASK, supported 'GATEWAY' available in 1.61.0+.

instance_list str

Instance list for cluster scale down. This value follows the json format, e.g. ["instance_id1","instance_id2"]. escape character for " is ".

instance_type str

Host Ecs instance type.

node_count str

Host number in this group.

period int

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

sys_disk_capacity str

System disk capacity.

sys_disk_type str

System disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,cloud_essd.

autoRenew Boolean

Auto renew for prepaid, ’true’ or ‘false’ . Default value: false.

chargeType String

Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.

decommissionTimeout Number

Graceful decommission timeout, unit: seconds.

diskCapacity String

Data disk capacity.

diskCount String

Data disk count.

diskType String

Data disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,local_disk,cloud_essd.

enableGracefulDecommission Boolean

Enable hadoop cluster of task node graceful decommission, ’true’ or ‘false’ . Default value: false.

gpuDriver String
hostGroupName String

host group name.

hostGroupType String

host group type, supported value: MASTER, CORE or TASK, supported 'GATEWAY' available in 1.61.0+.

instanceList String

Instance list for cluster scale down. This value follows the json format, e.g. ["instance_id1","instance_id2"]. escape character for " is ".

instanceType String

Host Ecs instance type.

nodeCount String

Host number in this group.

period Number

If charge type is PrePaid, this should be specified, unit is month. Supported value: 1、2、3、4、5、6、7、8、9、12、24、36.

sysDiskCapacity String

System disk capacity.

sysDiskType String

System disk type. Supported value: cloud,cloud_efficiency,cloud_ssd,cloud_essd.

ClusterMetaStoreConf

DbPassword string

Custom rds database password.

DbUrl string

Custom rds database connection url.

DbUserName string

Custom rds database user name.

DbPassword string

Custom rds database password.

DbUrl string

Custom rds database connection url.

DbUserName string

Custom rds database user name.

dbPassword String

Custom rds database password.

dbUrl String

Custom rds database connection url.

dbUserName String

Custom rds database user name.

dbPassword string

Custom rds database password.

dbUrl string

Custom rds database connection url.

dbUserName string

Custom rds database user name.

db_password str

Custom rds database password.

db_url str

Custom rds database connection url.

db_user_name str

Custom rds database user name.

dbPassword String

Custom rds database password.

dbUrl String

Custom rds database connection url.

dbUserName String

Custom rds database user name.

ClusterModifyClusterServiceConfig

ConfigParams string

Cluster service configuration modification params, e.g. ’{"hdfs-site":{"dfs.replication":"3"}}’.

ServiceName string

Custom configuration service name, e.g. ’HDFS’.

Comment string

Cluster service configuration modification comment, e.g. "Modify tez configuration".

ConfigType string

Cluster service configuration modification type.

CustomConfigParams string

Cluster service configuration modification custom params, e.g. ’{"tez-site":{"key":{"Value":"value"}}}’.

GatewayClusterIdLists List<string>

Cluster service configuration modification related gateway cluster id list.

GroupId string

Cluster service configuration modification node group id, e.g. ’G-XXX’.

HostInstanceId string

Cluster service configuration modification host instance id, e.g. ’i-bp146tnrkq4tcxxxxx’.

RefreshHostConfig bool

Cluster service configuration modification refresh host config, ’true’ or ’false’.

ConfigParams string

Cluster service configuration modification params, e.g. ’{"hdfs-site":{"dfs.replication":"3"}}’.

ServiceName string

Custom configuration service name, e.g. ’HDFS’.

Comment string

Cluster service configuration modification comment, e.g. "Modify tez configuration".

ConfigType string

Cluster service configuration modification type.

CustomConfigParams string

Cluster service configuration modification custom params, e.g. ’{"tez-site":{"key":{"Value":"value"}}}’.

GatewayClusterIdLists []string

Cluster service configuration modification related gateway cluster id list.

GroupId string

Cluster service configuration modification node group id, e.g. ’G-XXX’.

HostInstanceId string

Cluster service configuration modification host instance id, e.g. ’i-bp146tnrkq4tcxxxxx’.

RefreshHostConfig bool

Cluster service configuration modification refresh host config, ’true’ or ’false’.

configParams String

Cluster service configuration modification params, e.g. ’{"hdfs-site":{"dfs.replication":"3"}}’.

serviceName String

Custom configuration service name, e.g. ’HDFS’.

comment String

Cluster service configuration modification comment, e.g. "Modify tez configuration".

configType String

Cluster service configuration modification type.

customConfigParams String

Cluster service configuration modification custom params, e.g. ’{"tez-site":{"key":{"Value":"value"}}}’.

gatewayClusterIdLists List<String>

Cluster service configuration modification related gateway cluster id list.

groupId String

Cluster service configuration modification node group id, e.g. ’G-XXX’.

hostInstanceId String

Cluster service configuration modification host instance id, e.g. ’i-bp146tnrkq4tcxxxxx’.

refreshHostConfig Boolean

Cluster service configuration modification refresh host config, ’true’ or ’false’.

configParams string

Cluster service configuration modification params, e.g. ’{"hdfs-site":{"dfs.replication":"3"}}’.

serviceName string

Custom configuration service name, e.g. ’HDFS’.

comment string

Cluster service configuration modification comment, e.g. "Modify tez configuration".

configType string

Cluster service configuration modification type.

customConfigParams string

Cluster service configuration modification custom params, e.g. ’{"tez-site":{"key":{"Value":"value"}}}’.

gatewayClusterIdLists string[]

Cluster service configuration modification related gateway cluster id list.

groupId string

Cluster service configuration modification node group id, e.g. ’G-XXX’.

hostInstanceId string

Cluster service configuration modification host instance id, e.g. ’i-bp146tnrkq4tcxxxxx’.

refreshHostConfig boolean

Cluster service configuration modification refresh host config, ’true’ or ’false’.

config_params str

Cluster service configuration modification params, e.g. ’{"hdfs-site":{"dfs.replication":"3"}}’.

service_name str

Custom configuration service name, e.g. ’HDFS’.

comment str

Cluster service configuration modification comment, e.g. "Modify tez configuration".

config_type str

Cluster service configuration modification type.

custom_config_params str

Cluster service configuration modification custom params, e.g. ’{"tez-site":{"key":{"Value":"value"}}}’.

gateway_cluster_id_lists Sequence[str]

Cluster service configuration modification related gateway cluster id list.

group_id str

Cluster service configuration modification node group id, e.g. ’G-XXX’.

host_instance_id str

Cluster service configuration modification host instance id, e.g. ’i-bp146tnrkq4tcxxxxx’.

refresh_host_config bool

Cluster service configuration modification refresh host config, ’true’ or ’false’.

configParams String

Cluster service configuration modification params, e.g. ’{"hdfs-site":{"dfs.replication":"3"}}’.

serviceName String

Custom configuration service name, e.g. ’HDFS’.

comment String

Cluster service configuration modification comment, e.g. "Modify tez configuration".

configType String

Cluster service configuration modification type.

customConfigParams String

Cluster service configuration modification custom params, e.g. ’{"tez-site":{"key":{"Value":"value"}}}’.

gatewayClusterIdLists List<String>

Cluster service configuration modification related gateway cluster id list.

groupId String

Cluster service configuration modification node group id, e.g. ’G-XXX’.

hostInstanceId String

Cluster service configuration modification host instance id, e.g. ’i-bp146tnrkq4tcxxxxx’.

refreshHostConfig Boolean

Cluster service configuration modification refresh host config, ’true’ or ’false’.

Import

Aliclioud E-MapReduce cluster can be imported using the id e.g.

 $ pulumi import alicloud:emr/cluster:Cluster default C-B47FB8FE96C67XXXX

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.