1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. emr
  5. Cluster
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.emr.Cluster

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

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

    DEPRECATED: This resource has been deprecated from version 1.204.0. Please use new resource emrv2_cluster.

    NOTE: Available in 1.57.0+.

    Example Usage

    1. Create A Cluster

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.emr.getMainVersions({});
    const defaultGetInstanceTypes = _default.then(_default => alicloud.emr.getInstanceTypes({
        destinationResource: "InstanceType",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        supportLocalStorage: false,
        instanceChargeType: "PostPaid",
        supportNodeTypes: [
            "MASTER",
            "CORE",
            "TASK",
        ],
    }));
    const dataDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "DataDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const systemDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "SystemDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const vpc: alicloud.vpc.Network[] = [];
    for (const range = {value: 0}; range.value < (vpcId == "" ? 1 : 0); range.value++) {
        vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {
            name: vpcName,
            cidrBlock: vpcCidr,
        }));
    }
    const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
    for (const range = {value: 0}; range.value < (securityGroupId == "" ? 1 : 0); range.value++) {
        defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`default-${range.value}`, {
            name: securityGroupName,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // VSwitch Resource for Module
    const vswitch: alicloud.vpc.Switch[] = [];
    for (const range = {value: 0}; range.value < (vswitchId == "" ? 1 : 0); range.value++) {
        vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
            availabilityZone: availabilityZone == "" ? defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId) : availabilityZone,
            vswitchName: vswitchName,
            cidrBlock: vswitchCidr,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // Ram role Resource for Module
    const defaultRole = new alicloud.ram.Role("default", {
        name: ramName,
        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("default", {
        name: "terraform-create-cluster-test",
        emrVer: _default.then(_default => _default.mainVersions?.[0]?.emrVersion),
        clusterType: _default.then(_default => _default.mainVersions?.[0]?.clusterTypes?.[0]),
        hostGroups: [
            {
                hostGroupName: "master_group",
                hostGroupType: "MASTER",
                nodeCount: "2",
                instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId),
        securityGroupId: securityGroupId == "" ? defaultSecurityGroup[0].id : securityGroupId,
        isOpenPublicIp: true,
        chargeType: "PostPaid",
        vswitchId: vswitchId == "" ? vswitch[0].id : vswitchId,
        userDefinedEmrEcsRole: defaultRole.name,
        sshEnable: true,
        masterPwd: "ABCtest1234!",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.emr.get_main_versions()
    default_get_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
        cluster_type=default.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[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
        cluster_type=default.main_versions[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    vpc = []
    for range in [{"value": i} for i in range(0, 1 if vpc_id ==  else 0)]:
        vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}",
            name=vpc_name,
            cidr_block=vpc_cidr))
    default_security_group = []
    for range in [{"value": i} for i in range(0, 1 if security_group_id ==  else 0)]:
        default_security_group.append(alicloud.ecs.SecurityGroup(f"default-{range['value']}",
            name=security_group_name,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # VSwitch Resource for Module
    vswitch = []
    for range in [{"value": i} for i in range(0, 1 if vswitch_id ==  else 0)]:
        vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
            availability_zone=default_get_instance_types.types[0].zone_id if availability_zone == "" else availability_zone,
            vswitch_name=vswitch_name,
            cidr_block=vswitch_cidr,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # Ram role Resource for Module
    default_role = alicloud.ram.Role("default",
        name=ram_name,
        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("default",
        name="terraform-create-cluster-test",
        emr_ver=default.main_versions[0].emr_version,
        cluster_type=default.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_get_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_get_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_get_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_get_instance_types.types[0].zone_id,
        security_group_id=default_security_group[0].id if security_group_id == "" else security_group_id,
        is_open_public_ip=True,
        charge_type="PostPaid",
        vswitch_id=vswitch[0].id if vswitch_id == "" else vswitch_id,
        user_defined_emr_ecs_role=default_role.name,
        ssh_enable=True,
        master_pwd="ABCtest1234!")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/emr"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _default, err := emr.GetMainVersions(ctx, nil, nil);
    if err != nil {
    return err
    }
    defaultGetInstanceTypes, err := emr.GetInstanceTypes(ctx, &emr.GetInstanceTypesArgs{
    DestinationResource: "InstanceType",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    SupportLocalStorage: pulumi.BoolRef(false),
    InstanceChargeType: "PostPaid",
    SupportNodeTypes: []string{
    "MASTER",
    "CORE",
    "TASK",
    },
    }, nil);
    if err != nil {
    return err
    }
    dataDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "DataDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    systemDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "SystemDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    var tmp0 float64
    if vpcId == "" {
    tmp0 = 1
    } else {
    tmp0 = 0
    }
    var vpc []*vpc.Network
    for index := 0; index < tmp0; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewNetwork(ctx, fmt.Sprintf("vpc-%v", key0), &vpc.NetworkArgs{
    Name: pulumi.Any(vpcName),
    CidrBlock: pulumi.Any(vpcCidr),
    })
    if err != nil {
    return err
    }
    vpc = append(vpc, __res)
    }
    var tmp1 pulumi.String
    if vpcId == "" {
    tmp1 = vpc[0].ID()
    } else {
    tmp1 = pulumi.Any(vpcId)
    }
    var tmp2 float64
    if securityGroupId == "" {
    tmp2 = 1
    } else {
    tmp2 = 0
    }
    var defaultSecurityGroup []*ecs.SecurityGroup
    for index := 0; index < tmp2; index++ {
        key0 := index
        _ := index
    __res, err := ecs.NewSecurityGroup(ctx, fmt.Sprintf("default-%v", key0), &ecs.SecurityGroupArgs{
    Name: pulumi.Any(securityGroupName),
    VpcId: pulumi.String(tmp1),
    })
    if err != nil {
    return err
    }
    defaultSecurityGroup = append(defaultSecurityGroup, __res)
    }
    var tmp3 pulumi.String
    if availabilityZone == "" {
    tmp3 = pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId)
    } else {
    tmp3 = pulumi.Any(availabilityZone)
    }
    var tmp4 pulumi.String
    if vpcId == "" {
    tmp4 = vpc[0].ID()
    } else {
    tmp4 = pulumi.Any(vpcId)
    }
    // VSwitch Resource for Module
    var tmp5 float64
    if vswitchId == "" {
    tmp5 = 1
    } else {
    tmp5 = 0
    }
    var vswitch []*vpc.Switch
    for index := 0; index < tmp5; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewSwitch(ctx, fmt.Sprintf("vswitch-%v", key0), &vpc.SwitchArgs{
    AvailabilityZone: pulumi.String(tmp3),
    VswitchName: pulumi.Any(vswitchName),
    CidrBlock: pulumi.Any(vswitchCidr),
    VpcId: pulumi.String(tmp4),
    })
    if err != nil {
    return err
    }
    vswitch = append(vswitch, __res)
    }
    // Ram role Resource for Module
    defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
    Name: pulumi.Any(ramName),
    Document: pulumi.String(`    {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
    `),
    Description: pulumi.String("this is a role test."),
    Force: pulumi.Bool(true),
    })
    if err != nil {
    return err
    }
    var tmp6 pulumi.String
    if securityGroupId == "" {
    tmp6 = defaultSecurityGroup[0].ID()
    } else {
    tmp6 = pulumi.Any(securityGroupId)
    }
    var tmp7 pulumi.String
    if vswitchId == "" {
    tmp7 = vswitch[0].ID()
    } else {
    tmp7 = pulumi.Any(vswitchId)
    }
    _, err = emr.NewCluster(ctx, "default", &emr.ClusterArgs{
    Name: pulumi.String("terraform-create-cluster-test"),
    EmrVer: pulumi.String(_default.MainVersions[0].EmrVersion),
    ClusterType: pulumi.String(_default.MainVersions[0].ClusterTypes[0]),
    HostGroups: emr.ClusterHostGroupArray{
    var tmp8 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp8 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp8 = pulumi.String("160")
    }
    var tmp9 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp9 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp9 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("master_group"),
    HostGroupType: pulumi.String("MASTER"),
    NodeCount: pulumi.String("2"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp8),
    DiskCount: pulumi.String("1"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp9),
    },
    var tmp10 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp10 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp10 = pulumi.String("160")
    }
    var tmp11 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp11 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp11 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("core_group"),
    HostGroupType: pulumi.String("CORE"),
    NodeCount: pulumi.String("3"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp10),
    DiskCount: pulumi.String("4"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp11),
    },
    var tmp12 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp12 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp12 = pulumi.String("160")
    }
    var tmp13 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp13 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp13 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("task_group"),
    HostGroupType: pulumi.String("TASK"),
    NodeCount: pulumi.String("2"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp12),
    DiskCount: pulumi.String("4"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp13),
    },
    },
    HighAvailabilityEnable: pulumi.Bool(true),
    ZoneId: pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId),
    SecurityGroupId: pulumi.String(tmp6),
    IsOpenPublicIp: pulumi.Bool(true),
    ChargeType: pulumi.String("PostPaid"),
    VswitchId: pulumi.String(tmp7),
    UserDefinedEmrEcsRole: defaultRole.Name,
    SshEnable: pulumi.Bool(true),
    MasterPwd: pulumi.String("ABCtest1234!"),
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.Emr.GetMainVersions.Invoke();
    
        var defaultGetInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
        {
            DestinationResource = "InstanceType",
            ClusterType = @default.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 = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
        {
            DestinationResource = "SystemDisk",
            ClusterType = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var vpc = new List<AliCloud.Vpc.Network>();
        for (var rangeIndex = 0; rangeIndex < (vpcId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
            {
                Name = vpcName,
                CidrBlock = vpcCidr,
            }));
        }
        var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
        for (var rangeIndex = 0; rangeIndex < (securityGroupId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"default-{range.Value}", new()
            {
                Name = securityGroupName,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // VSwitch Resource for Module
        var vswitch = new List<AliCloud.Vpc.Switch>();
        for (var rangeIndex = 0; rangeIndex < (vswitchId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
            {
                AvailabilityZone = availabilityZone == "" ? defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : availabilityZone,
                VswitchName = vswitchName,
                CidrBlock = vswitchCidr,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // Ram role Resource for Module
        var defaultRole = new AliCloud.Ram.Role("default", new()
        {
            Name = ramName,
            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("default", new()
        {
            Name = "terraform-create-cluster-test",
            EmrVer = @default.Apply(@default => @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion)),
            ClusterType = @default.Apply(@default => @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0])),
            HostGroups = new[]
            {
                new AliCloud.Emr.Inputs.ClusterHostGroupArgs
                {
                    HostGroupName = "master_group",
                    HostGroupType = "MASTER",
                    NodeCount = "2",
                    InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
            SecurityGroupId = securityGroupId == "" ? defaultSecurityGroup[0].Id : securityGroupId,
            IsOpenPublicIp = true,
            ChargeType = "PostPaid",
            VswitchId = vswitchId == "" ? vswitch[0].Id : vswitchId,
            UserDefinedEmrEcsRole = defaultRole.Name,
            SshEnable = true,
            MasterPwd = "ABCtest1234!",
        });
    
    });
    
    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 default = EmrFunctions.getMainVersions();
    
            final var defaultGetInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .destinationResource("InstanceType")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .supportLocalStorage(false)
                .instanceChargeType("PostPaid")
                .supportNodeTypes(            
                    "MASTER",
                    "CORE",
                    "TASK")
                .build());
    
            final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("DataDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("SystemDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            for (var i = 0; i < (vpcId == "" ? 1 : 0); i++) {
                new Network("vpc-" + i, NetworkArgs.builder()
                    .name(vpcName)
                    .cidrBlock(vpcCidr)
                    .build());
    
            
    }
            for (var i = 0; i < (securityGroupId == "" ? 1 : 0); i++) {
                new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()
                    .name(securityGroupName)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // VSwitch Resource for Module
            for (var i = 0; i < (vswitchId == "" ? 1 : 0); i++) {
                new Switch("vswitch-" + i, SwitchArgs.builder()
                    .availabilityZone(availabilityZone == "" ? defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : availabilityZone)
                    .vswitchName(vswitchName)
                    .cidrBlock(vswitchCidr)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // Ram role Resource for Module
            var defaultRole = new Role("defaultRole", RoleArgs.builder()
                .name(ramName)
                .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()
                .name("terraform-create-cluster-test")
                .emrVer(default_.mainVersions()[0].emrVersion())
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .hostGroups(            
                    ClusterHostGroupArgs.builder()
                        .hostGroupName("master_group")
                        .hostGroupType("MASTER")
                        .nodeCount("2")
                        .instanceType(defaultGetInstanceTypes.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(defaultGetInstanceTypes.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(defaultGetInstanceTypes.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(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .securityGroupId(securityGroupId == "" ? defaultSecurityGroup[0].id() : securityGroupId)
                .isOpenPublicIp(true)
                .chargeType("PostPaid")
                .vswitchId(vswitchId == "" ? vswitch[0].id() : vswitchId)
                .userDefinedEmrEcsRole(defaultRole.name())
                .sshEnable(true)
                .masterPwd("ABCtest1234!")
                .build());
    
        }
    }
    
    Coming soon!
    

    2. Scale Up

    The hosts of EMR Cluster are orginized as host group. Scaling up/down is operating host group.

    In the case of scaling up cluster, we should add the node_count of some host group.

    NOTE: Scaling up is only applicable to CORE and TASK group. Cost time of scaling up will vary with the number of scaling-up nodes. Scaling down is only applicable to TASK group. If you want to scale down CORE group, please submit tickets or contact EMR support team.

    As the following case, we scale up the TASK group 2 nodes by increasing host_group.node_count by 2.

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.emr.getMainVersions({});
    const defaultGetInstanceTypes = _default.then(_default => alicloud.emr.getInstanceTypes({
        destinationResource: "InstanceType",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        supportLocalStorage: false,
        instanceChargeType: "PostPaid",
        supportNodeTypes: [
            "MASTER",
            "CORE",
            "TASK",
        ],
    }));
    const dataDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "DataDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const systemDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "SystemDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const vpc: alicloud.vpc.Network[] = [];
    for (const range = {value: 0}; range.value < (vpcId == "" ? 1 : 0); range.value++) {
        vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {
            name: vpcName,
            cidrBlock: vpcCidr,
        }));
    }
    const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
    for (const range = {value: 0}; range.value < (securityGroupId == "" ? 1 : 0); range.value++) {
        defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`default-${range.value}`, {
            name: securityGroupName,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // VSwitch Resource for Module
    const vswitch: alicloud.vpc.Switch[] = [];
    for (const range = {value: 0}; range.value < (vswitchId == "" ? 1 : 0); range.value++) {
        vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
            availabilityZone: availabilityZone == "" ? defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId) : availabilityZone,
            vswitchName: vswitchName,
            cidrBlock: vswitchCidr,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // Ram role Resource for Module
    const defaultRole = new alicloud.ram.Role("default", {
        name: ramName,
        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("default", {
        name: "terraform-resize-cluster-test",
        emrVer: _default.then(_default => _default.mainVersions?.[0]?.emrVersion),
        clusterType: _default.then(_default => _default.mainVersions?.[0]?.clusterTypes?.[0]),
        hostGroups: [
            {
                hostGroupName: "master_group",
                hostGroupType: "MASTER",
                nodeCount: "2",
                instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId),
        securityGroupId: securityGroupId == "" ? defaultSecurityGroup[0].id : securityGroupId,
        isOpenPublicIp: true,
        chargeType: "PostPaid",
        vswitchId: vswitchId == "" ? vswitch[0].id : vswitchId,
        userDefinedEmrEcsRole: defaultRole.name,
        sshEnable: true,
        masterPwd: "ABCtest1234!",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.emr.get_main_versions()
    default_get_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
        cluster_type=default.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[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
        cluster_type=default.main_versions[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    vpc = []
    for range in [{"value": i} for i in range(0, 1 if vpc_id ==  else 0)]:
        vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}",
            name=vpc_name,
            cidr_block=vpc_cidr))
    default_security_group = []
    for range in [{"value": i} for i in range(0, 1 if security_group_id ==  else 0)]:
        default_security_group.append(alicloud.ecs.SecurityGroup(f"default-{range['value']}",
            name=security_group_name,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # VSwitch Resource for Module
    vswitch = []
    for range in [{"value": i} for i in range(0, 1 if vswitch_id ==  else 0)]:
        vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
            availability_zone=default_get_instance_types.types[0].zone_id if availability_zone == "" else availability_zone,
            vswitch_name=vswitch_name,
            cidr_block=vswitch_cidr,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # Ram role Resource for Module
    default_role = alicloud.ram.Role("default",
        name=ram_name,
        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("default",
        name="terraform-resize-cluster-test",
        emr_ver=default.main_versions[0].emr_version,
        cluster_type=default.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_get_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_get_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_get_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_get_instance_types.types[0].zone_id,
        security_group_id=default_security_group[0].id if security_group_id == "" else security_group_id,
        is_open_public_ip=True,
        charge_type="PostPaid",
        vswitch_id=vswitch[0].id if vswitch_id == "" else vswitch_id,
        user_defined_emr_ecs_role=default_role.name,
        ssh_enable=True,
        master_pwd="ABCtest1234!")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/emr"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _default, err := emr.GetMainVersions(ctx, nil, nil);
    if err != nil {
    return err
    }
    defaultGetInstanceTypes, err := emr.GetInstanceTypes(ctx, &emr.GetInstanceTypesArgs{
    DestinationResource: "InstanceType",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    SupportLocalStorage: pulumi.BoolRef(false),
    InstanceChargeType: "PostPaid",
    SupportNodeTypes: []string{
    "MASTER",
    "CORE",
    "TASK",
    },
    }, nil);
    if err != nil {
    return err
    }
    dataDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "DataDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    systemDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "SystemDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    var tmp0 float64
    if vpcId == "" {
    tmp0 = 1
    } else {
    tmp0 = 0
    }
    var vpc []*vpc.Network
    for index := 0; index < tmp0; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewNetwork(ctx, fmt.Sprintf("vpc-%v", key0), &vpc.NetworkArgs{
    Name: pulumi.Any(vpcName),
    CidrBlock: pulumi.Any(vpcCidr),
    })
    if err != nil {
    return err
    }
    vpc = append(vpc, __res)
    }
    var tmp1 pulumi.String
    if vpcId == "" {
    tmp1 = vpc[0].ID()
    } else {
    tmp1 = pulumi.Any(vpcId)
    }
    var tmp2 float64
    if securityGroupId == "" {
    tmp2 = 1
    } else {
    tmp2 = 0
    }
    var defaultSecurityGroup []*ecs.SecurityGroup
    for index := 0; index < tmp2; index++ {
        key0 := index
        _ := index
    __res, err := ecs.NewSecurityGroup(ctx, fmt.Sprintf("default-%v", key0), &ecs.SecurityGroupArgs{
    Name: pulumi.Any(securityGroupName),
    VpcId: pulumi.String(tmp1),
    })
    if err != nil {
    return err
    }
    defaultSecurityGroup = append(defaultSecurityGroup, __res)
    }
    var tmp3 pulumi.String
    if availabilityZone == "" {
    tmp3 = pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId)
    } else {
    tmp3 = pulumi.Any(availabilityZone)
    }
    var tmp4 pulumi.String
    if vpcId == "" {
    tmp4 = vpc[0].ID()
    } else {
    tmp4 = pulumi.Any(vpcId)
    }
    // VSwitch Resource for Module
    var tmp5 float64
    if vswitchId == "" {
    tmp5 = 1
    } else {
    tmp5 = 0
    }
    var vswitch []*vpc.Switch
    for index := 0; index < tmp5; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewSwitch(ctx, fmt.Sprintf("vswitch-%v", key0), &vpc.SwitchArgs{
    AvailabilityZone: pulumi.String(tmp3),
    VswitchName: pulumi.Any(vswitchName),
    CidrBlock: pulumi.Any(vswitchCidr),
    VpcId: pulumi.String(tmp4),
    })
    if err != nil {
    return err
    }
    vswitch = append(vswitch, __res)
    }
    // Ram role Resource for Module
    defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
    Name: pulumi.Any(ramName),
    Document: pulumi.String(`    {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
    `),
    Description: pulumi.String("this is a role test."),
    Force: pulumi.Bool(true),
    })
    if err != nil {
    return err
    }
    var tmp6 pulumi.String
    if securityGroupId == "" {
    tmp6 = defaultSecurityGroup[0].ID()
    } else {
    tmp6 = pulumi.Any(securityGroupId)
    }
    var tmp7 pulumi.String
    if vswitchId == "" {
    tmp7 = vswitch[0].ID()
    } else {
    tmp7 = pulumi.Any(vswitchId)
    }
    _, err = emr.NewCluster(ctx, "default", &emr.ClusterArgs{
    Name: pulumi.String("terraform-resize-cluster-test"),
    EmrVer: pulumi.String(_default.MainVersions[0].EmrVersion),
    ClusterType: pulumi.String(_default.MainVersions[0].ClusterTypes[0]),
    HostGroups: emr.ClusterHostGroupArray{
    var tmp8 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp8 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp8 = pulumi.String("160")
    }
    var tmp9 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp9 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp9 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("master_group"),
    HostGroupType: pulumi.String("MASTER"),
    NodeCount: pulumi.String("2"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp8),
    DiskCount: pulumi.String("1"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp9),
    },
    var tmp10 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp10 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp10 = pulumi.String("160")
    }
    var tmp11 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp11 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp11 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("core_group"),
    HostGroupType: pulumi.String("CORE"),
    NodeCount: pulumi.String("3"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp10),
    DiskCount: pulumi.String("4"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp11),
    },
    var tmp12 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp12 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp12 = pulumi.String("160")
    }
    var tmp13 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp13 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp13 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("task_group"),
    HostGroupType: pulumi.String("TASK"),
    NodeCount: pulumi.String("4"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp12),
    DiskCount: pulumi.String("4"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp13),
    },
    },
    HighAvailabilityEnable: pulumi.Bool(true),
    ZoneId: pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId),
    SecurityGroupId: pulumi.String(tmp6),
    IsOpenPublicIp: pulumi.Bool(true),
    ChargeType: pulumi.String("PostPaid"),
    VswitchId: pulumi.String(tmp7),
    UserDefinedEmrEcsRole: defaultRole.Name,
    SshEnable: pulumi.Bool(true),
    MasterPwd: pulumi.String("ABCtest1234!"),
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.Emr.GetMainVersions.Invoke();
    
        var defaultGetInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
        {
            DestinationResource = "InstanceType",
            ClusterType = @default.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 = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
        {
            DestinationResource = "SystemDisk",
            ClusterType = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var vpc = new List<AliCloud.Vpc.Network>();
        for (var rangeIndex = 0; rangeIndex < (vpcId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
            {
                Name = vpcName,
                CidrBlock = vpcCidr,
            }));
        }
        var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
        for (var rangeIndex = 0; rangeIndex < (securityGroupId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"default-{range.Value}", new()
            {
                Name = securityGroupName,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // VSwitch Resource for Module
        var vswitch = new List<AliCloud.Vpc.Switch>();
        for (var rangeIndex = 0; rangeIndex < (vswitchId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
            {
                AvailabilityZone = availabilityZone == "" ? defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : availabilityZone,
                VswitchName = vswitchName,
                CidrBlock = vswitchCidr,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // Ram role Resource for Module
        var defaultRole = new AliCloud.Ram.Role("default", new()
        {
            Name = ramName,
            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("default", new()
        {
            Name = "terraform-resize-cluster-test",
            EmrVer = @default.Apply(@default => @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion)),
            ClusterType = @default.Apply(@default => @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0])),
            HostGroups = new[]
            {
                new AliCloud.Emr.Inputs.ClusterHostGroupArgs
                {
                    HostGroupName = "master_group",
                    HostGroupType = "MASTER",
                    NodeCount = "2",
                    InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
            SecurityGroupId = securityGroupId == "" ? defaultSecurityGroup[0].Id : securityGroupId,
            IsOpenPublicIp = true,
            ChargeType = "PostPaid",
            VswitchId = vswitchId == "" ? vswitch[0].Id : vswitchId,
            UserDefinedEmrEcsRole = defaultRole.Name,
            SshEnable = true,
            MasterPwd = "ABCtest1234!",
        });
    
    });
    
    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 default = EmrFunctions.getMainVersions();
    
            final var defaultGetInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .destinationResource("InstanceType")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .supportLocalStorage(false)
                .instanceChargeType("PostPaid")
                .supportNodeTypes(            
                    "MASTER",
                    "CORE",
                    "TASK")
                .build());
    
            final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("DataDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("SystemDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            for (var i = 0; i < (vpcId == "" ? 1 : 0); i++) {
                new Network("vpc-" + i, NetworkArgs.builder()
                    .name(vpcName)
                    .cidrBlock(vpcCidr)
                    .build());
    
            
    }
            for (var i = 0; i < (securityGroupId == "" ? 1 : 0); i++) {
                new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()
                    .name(securityGroupName)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // VSwitch Resource for Module
            for (var i = 0; i < (vswitchId == "" ? 1 : 0); i++) {
                new Switch("vswitch-" + i, SwitchArgs.builder()
                    .availabilityZone(availabilityZone == "" ? defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : availabilityZone)
                    .vswitchName(vswitchName)
                    .cidrBlock(vswitchCidr)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // Ram role Resource for Module
            var defaultRole = new Role("defaultRole", RoleArgs.builder()
                .name(ramName)
                .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()
                .name("terraform-resize-cluster-test")
                .emrVer(default_.mainVersions()[0].emrVersion())
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .hostGroups(            
                    ClusterHostGroupArgs.builder()
                        .hostGroupName("master_group")
                        .hostGroupType("MASTER")
                        .nodeCount("2")
                        .instanceType(defaultGetInstanceTypes.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(defaultGetInstanceTypes.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(defaultGetInstanceTypes.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(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .securityGroupId(securityGroupId == "" ? defaultSecurityGroup[0].id() : securityGroupId)
                .isOpenPublicIp(true)
                .chargeType("PostPaid")
                .vswitchId(vswitchId == "" ? vswitch[0].id() : vswitchId)
                .userDefinedEmrEcsRole(defaultRole.name())
                .sshEnable(true)
                .masterPwd("ABCtest1234!")
                .build());
    
        }
    }
    
    Coming soon!
    

    3. Scale Down

    In the case of scaling down a cluster, we need to specified the host group and the instance list.

    NOTE: Graceful decommission of hadoop cluster has been supported Available in 1.168.0+.

    The following is an example. We scale down the cluster by decreasing the node count by 2, and specifying the scale-down instance list.

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.emr.getMainVersions({});
    const defaultGetInstanceTypes = _default.then(_default => alicloud.emr.getInstanceTypes({
        destinationResource: "InstanceType",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        supportLocalStorage: false,
        instanceChargeType: "PostPaid",
        supportNodeTypes: [
            "MASTER",
            "CORE",
            "TASK",
        ],
    }));
    const dataDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "DataDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const systemDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "SystemDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const vpc: alicloud.vpc.Network[] = [];
    for (const range = {value: 0}; range.value < (vpcId == "" ? 1 : 0); range.value++) {
        vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {
            name: vpcName,
            cidrBlock: vpcCidr,
        }));
    }
    const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
    for (const range = {value: 0}; range.value < (securityGroupId == "" ? 1 : 0); range.value++) {
        defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`default-${range.value}`, {
            name: securityGroupName,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // VSwitch Resource for Module
    const vswitch: alicloud.vpc.Switch[] = [];
    for (const range = {value: 0}; range.value < (vswitchId == "" ? 1 : 0); range.value++) {
        vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
            availabilityZone: availabilityZone == "" ? defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId) : availabilityZone,
            vswitchName: vswitchName,
            cidrBlock: vswitchCidr,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // Ram role Resource for Module
    const defaultRole = new alicloud.ram.Role("default", {
        name: ramName,
        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("default", {
        name: "terraform-resize-cluster-test",
        emrVer: _default.then(_default => _default.mainVersions?.[0]?.emrVersion),
        clusterType: _default.then(_default => _default.mainVersions?.[0]?.clusterTypes?.[0]),
        hostGroups: [
            {
                hostGroupName: "master_group",
                hostGroupType: "MASTER",
                nodeCount: "2",
                instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId),
        securityGroupId: securityGroupId == "" ? defaultSecurityGroup[0].id : securityGroupId,
        isOpenPublicIp: true,
        chargeType: "PostPaid",
        vswitchId: vswitchId == "" ? vswitch[0].id : vswitchId,
        userDefinedEmrEcsRole: defaultRole.name,
        sshEnable: true,
        masterPwd: "ABCtest1234!",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.emr.get_main_versions()
    default_get_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
        cluster_type=default.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[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
        cluster_type=default.main_versions[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    vpc = []
    for range in [{"value": i} for i in range(0, 1 if vpc_id ==  else 0)]:
        vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}",
            name=vpc_name,
            cidr_block=vpc_cidr))
    default_security_group = []
    for range in [{"value": i} for i in range(0, 1 if security_group_id ==  else 0)]:
        default_security_group.append(alicloud.ecs.SecurityGroup(f"default-{range['value']}",
            name=security_group_name,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # VSwitch Resource for Module
    vswitch = []
    for range in [{"value": i} for i in range(0, 1 if vswitch_id ==  else 0)]:
        vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
            availability_zone=default_get_instance_types.types[0].zone_id if availability_zone == "" else availability_zone,
            vswitch_name=vswitch_name,
            cidr_block=vswitch_cidr,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # Ram role Resource for Module
    default_role = alicloud.ram.Role("default",
        name=ram_name,
        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("default",
        name="terraform-resize-cluster-test",
        emr_ver=default.main_versions[0].emr_version,
        cluster_type=default.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_get_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_get_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_get_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_get_instance_types.types[0].zone_id,
        security_group_id=default_security_group[0].id if security_group_id == "" else security_group_id,
        is_open_public_ip=True,
        charge_type="PostPaid",
        vswitch_id=vswitch[0].id if vswitch_id == "" else vswitch_id,
        user_defined_emr_ecs_role=default_role.name,
        ssh_enable=True,
        master_pwd="ABCtest1234!")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/emr"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _default, err := emr.GetMainVersions(ctx, nil, nil);
    if err != nil {
    return err
    }
    defaultGetInstanceTypes, err := emr.GetInstanceTypes(ctx, &emr.GetInstanceTypesArgs{
    DestinationResource: "InstanceType",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    SupportLocalStorage: pulumi.BoolRef(false),
    InstanceChargeType: "PostPaid",
    SupportNodeTypes: []string{
    "MASTER",
    "CORE",
    "TASK",
    },
    }, nil);
    if err != nil {
    return err
    }
    dataDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "DataDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    systemDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "SystemDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    var tmp0 float64
    if vpcId == "" {
    tmp0 = 1
    } else {
    tmp0 = 0
    }
    var vpc []*vpc.Network
    for index := 0; index < tmp0; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewNetwork(ctx, fmt.Sprintf("vpc-%v", key0), &vpc.NetworkArgs{
    Name: pulumi.Any(vpcName),
    CidrBlock: pulumi.Any(vpcCidr),
    })
    if err != nil {
    return err
    }
    vpc = append(vpc, __res)
    }
    var tmp1 pulumi.String
    if vpcId == "" {
    tmp1 = vpc[0].ID()
    } else {
    tmp1 = pulumi.Any(vpcId)
    }
    var tmp2 float64
    if securityGroupId == "" {
    tmp2 = 1
    } else {
    tmp2 = 0
    }
    var defaultSecurityGroup []*ecs.SecurityGroup
    for index := 0; index < tmp2; index++ {
        key0 := index
        _ := index
    __res, err := ecs.NewSecurityGroup(ctx, fmt.Sprintf("default-%v", key0), &ecs.SecurityGroupArgs{
    Name: pulumi.Any(securityGroupName),
    VpcId: pulumi.String(tmp1),
    })
    if err != nil {
    return err
    }
    defaultSecurityGroup = append(defaultSecurityGroup, __res)
    }
    var tmp3 pulumi.String
    if availabilityZone == "" {
    tmp3 = pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId)
    } else {
    tmp3 = pulumi.Any(availabilityZone)
    }
    var tmp4 pulumi.String
    if vpcId == "" {
    tmp4 = vpc[0].ID()
    } else {
    tmp4 = pulumi.Any(vpcId)
    }
    // VSwitch Resource for Module
    var tmp5 float64
    if vswitchId == "" {
    tmp5 = 1
    } else {
    tmp5 = 0
    }
    var vswitch []*vpc.Switch
    for index := 0; index < tmp5; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewSwitch(ctx, fmt.Sprintf("vswitch-%v", key0), &vpc.SwitchArgs{
    AvailabilityZone: pulumi.String(tmp3),
    VswitchName: pulumi.Any(vswitchName),
    CidrBlock: pulumi.Any(vswitchCidr),
    VpcId: pulumi.String(tmp4),
    })
    if err != nil {
    return err
    }
    vswitch = append(vswitch, __res)
    }
    // Ram role Resource for Module
    defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
    Name: pulumi.Any(ramName),
    Document: pulumi.String(`    {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
    `),
    Description: pulumi.String("this is a role test."),
    Force: pulumi.Bool(true),
    })
    if err != nil {
    return err
    }
    var tmp6 pulumi.String
    if securityGroupId == "" {
    tmp6 = defaultSecurityGroup[0].ID()
    } else {
    tmp6 = pulumi.Any(securityGroupId)
    }
    var tmp7 pulumi.String
    if vswitchId == "" {
    tmp7 = vswitch[0].ID()
    } else {
    tmp7 = pulumi.Any(vswitchId)
    }
    _, err = emr.NewCluster(ctx, "default", &emr.ClusterArgs{
    Name: pulumi.String("terraform-resize-cluster-test"),
    EmrVer: pulumi.String(_default.MainVersions[0].EmrVersion),
    ClusterType: pulumi.String(_default.MainVersions[0].ClusterTypes[0]),
    HostGroups: emr.ClusterHostGroupArray{
    var tmp8 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp8 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp8 = pulumi.String("160")
    }
    var tmp9 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp9 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp9 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("master_group"),
    HostGroupType: pulumi.String("MASTER"),
    NodeCount: pulumi.String("2"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp8),
    DiskCount: pulumi.String("1"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp9),
    },
    var tmp10 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp10 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp10 = pulumi.String("160")
    }
    var tmp11 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp11 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp11 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("core_group"),
    HostGroupType: pulumi.String("CORE"),
    NodeCount: pulumi.String("3"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp10),
    DiskCount: pulumi.String("4"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp11),
    },
    var tmp12 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp12 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp12 = pulumi.String("160")
    }
    var tmp13 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp13 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp13 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("task_group"),
    HostGroupType: pulumi.String("TASK"),
    NodeCount: pulumi.String("2"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp12),
    DiskCount: pulumi.String("4"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp13),
    },
    },
    HighAvailabilityEnable: pulumi.Bool(true),
    ZoneId: pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId),
    SecurityGroupId: pulumi.String(tmp6),
    IsOpenPublicIp: pulumi.Bool(true),
    ChargeType: pulumi.String("PostPaid"),
    VswitchId: pulumi.String(tmp7),
    UserDefinedEmrEcsRole: defaultRole.Name,
    SshEnable: pulumi.Bool(true),
    MasterPwd: pulumi.String("ABCtest1234!"),
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.Emr.GetMainVersions.Invoke();
    
        var defaultGetInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
        {
            DestinationResource = "InstanceType",
            ClusterType = @default.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 = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
        {
            DestinationResource = "SystemDisk",
            ClusterType = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var vpc = new List<AliCloud.Vpc.Network>();
        for (var rangeIndex = 0; rangeIndex < (vpcId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
            {
                Name = vpcName,
                CidrBlock = vpcCidr,
            }));
        }
        var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
        for (var rangeIndex = 0; rangeIndex < (securityGroupId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"default-{range.Value}", new()
            {
                Name = securityGroupName,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // VSwitch Resource for Module
        var vswitch = new List<AliCloud.Vpc.Switch>();
        for (var rangeIndex = 0; rangeIndex < (vswitchId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
            {
                AvailabilityZone = availabilityZone == "" ? defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : availabilityZone,
                VswitchName = vswitchName,
                CidrBlock = vswitchCidr,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // Ram role Resource for Module
        var defaultRole = new AliCloud.Ram.Role("default", new()
        {
            Name = ramName,
            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("default", new()
        {
            Name = "terraform-resize-cluster-test",
            EmrVer = @default.Apply(@default => @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion)),
            ClusterType = @default.Apply(@default => @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0])),
            HostGroups = new[]
            {
                new AliCloud.Emr.Inputs.ClusterHostGroupArgs
                {
                    HostGroupName = "master_group",
                    HostGroupType = "MASTER",
                    NodeCount = "2",
                    InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
            SecurityGroupId = securityGroupId == "" ? defaultSecurityGroup[0].Id : securityGroupId,
            IsOpenPublicIp = true,
            ChargeType = "PostPaid",
            VswitchId = vswitchId == "" ? vswitch[0].Id : vswitchId,
            UserDefinedEmrEcsRole = defaultRole.Name,
            SshEnable = true,
            MasterPwd = "ABCtest1234!",
        });
    
    });
    
    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 default = EmrFunctions.getMainVersions();
    
            final var defaultGetInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .destinationResource("InstanceType")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .supportLocalStorage(false)
                .instanceChargeType("PostPaid")
                .supportNodeTypes(            
                    "MASTER",
                    "CORE",
                    "TASK")
                .build());
    
            final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("DataDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("SystemDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            for (var i = 0; i < (vpcId == "" ? 1 : 0); i++) {
                new Network("vpc-" + i, NetworkArgs.builder()
                    .name(vpcName)
                    .cidrBlock(vpcCidr)
                    .build());
    
            
    }
            for (var i = 0; i < (securityGroupId == "" ? 1 : 0); i++) {
                new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()
                    .name(securityGroupName)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // VSwitch Resource for Module
            for (var i = 0; i < (vswitchId == "" ? 1 : 0); i++) {
                new Switch("vswitch-" + i, SwitchArgs.builder()
                    .availabilityZone(availabilityZone == "" ? defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : availabilityZone)
                    .vswitchName(vswitchName)
                    .cidrBlock(vswitchCidr)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // Ram role Resource for Module
            var defaultRole = new Role("defaultRole", RoleArgs.builder()
                .name(ramName)
                .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()
                .name("terraform-resize-cluster-test")
                .emrVer(default_.mainVersions()[0].emrVersion())
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .hostGroups(            
                    ClusterHostGroupArgs.builder()
                        .hostGroupName("master_group")
                        .hostGroupType("MASTER")
                        .nodeCount("2")
                        .instanceType(defaultGetInstanceTypes.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(defaultGetInstanceTypes.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(defaultGetInstanceTypes.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(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .securityGroupId(securityGroupId == "" ? defaultSecurityGroup[0].id() : securityGroupId)
                .isOpenPublicIp(true)
                .chargeType("PostPaid")
                .vswitchId(vswitchId == "" ? vswitch[0].id() : vswitchId)
                .userDefinedEmrEcsRole(defaultRole.name())
                .sshEnable(true)
                .masterPwd("ABCtest1234!")
                .build());
    
        }
    }
    
    Coming soon!
    

    4. Create a emr gateway cluster

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.emr.getMainVersions({});
    const defaultGetInstanceTypes = _default.then(_default => alicloud.emr.getInstanceTypes({
        destinationResource: "InstanceType",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        supportLocalStorage: false,
        instanceChargeType: "PostPaid",
        supportNodeTypes: ["GATEWAY"],
    }));
    const dataDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "DataDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const systemDisk = Promise.all([_default, defaultGetInstanceTypes, defaultGetInstanceTypes]).then(([_default, defaultGetInstanceTypes, defaultGetInstanceTypes1]) => alicloud.emr.getDiskTypes({
        destinationResource: "SystemDisk",
        clusterType: _default.mainVersions?.[0]?.clusterTypes?.[0],
        instanceChargeType: "PostPaid",
        instanceType: defaultGetInstanceTypes.types?.[0]?.id,
        zoneId: defaultGetInstanceTypes1.types?.[0]?.zoneId,
    }));
    const vpc: alicloud.vpc.Network[] = [];
    for (const range = {value: 0}; range.value < (vpcId == "" ? 1 : 0); range.value++) {
        vpc.push(new alicloud.vpc.Network(`vpc-${range.value}`, {
            name: vpcName,
            cidrBlock: vpcCidr,
        }));
    }
    const defaultSecurityGroup: alicloud.ecs.SecurityGroup[] = [];
    for (const range = {value: 0}; range.value < (securityGroupId == "" ? 1 : 0); range.value++) {
        defaultSecurityGroup.push(new alicloud.ecs.SecurityGroup(`default-${range.value}`, {
            name: securityGroupName,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // VSwitch Resource for Module
    const vswitch: alicloud.vpc.Switch[] = [];
    for (const range = {value: 0}; range.value < (vswitchId == "" ? 1 : 0); range.value++) {
        vswitch.push(new alicloud.vpc.Switch(`vswitch-${range.value}`, {
            availabilityZone: availabilityZone == "" ? defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId) : availabilityZone,
            vswitchName: vswitchName,
            cidrBlock: vswitchCidr,
            vpcId: vpcId == "" ? vpc[0].id : vpcId,
        }));
    }
    // Ram role Resource for Module
    const defaultRole = new alicloud.ram.Role("default", {
        name: ramName,
        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", {
        name: "terraform-gateway-cluster-test",
        emrVer: _default.then(_default => _default.mainVersions?.[0]?.emrVersion),
        clusterType: "GATEWAY",
        hostGroups: [{
            hostGroupName: "master_group",
            hostGroupType: "GATEWAY",
            nodeCount: "1",
            instanceType: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.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: defaultGetInstanceTypes.then(defaultGetInstanceTypes => defaultGetInstanceTypes.types?.[0]?.zoneId),
        securityGroupId: securityGroupId == "" ? defaultSecurityGroup[0].id : securityGroupId,
        isOpenPublicIp: true,
        chargeType: "PostPaid",
        vswitchId: vswitchId == "" ? vswitch[0].id : vswitchId,
        userDefinedEmrEcsRole: defaultRole.name,
        sshEnable: true,
        masterPwd: "ABCtest1234!",
        relatedClusterId: relatedClusterId,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.emr.get_main_versions()
    default_get_instance_types = alicloud.emr.get_instance_types(destination_resource="InstanceType",
        cluster_type=default.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[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    system_disk = alicloud.emr.get_disk_types(destination_resource="SystemDisk",
        cluster_type=default.main_versions[0].cluster_types[0],
        instance_charge_type="PostPaid",
        instance_type=default_get_instance_types.types[0].id,
        zone_id=default_get_instance_types.types[0].zone_id)
    vpc = []
    for range in [{"value": i} for i in range(0, 1 if vpc_id ==  else 0)]:
        vpc.append(alicloud.vpc.Network(f"vpc-{range['value']}",
            name=vpc_name,
            cidr_block=vpc_cidr))
    default_security_group = []
    for range in [{"value": i} for i in range(0, 1 if security_group_id ==  else 0)]:
        default_security_group.append(alicloud.ecs.SecurityGroup(f"default-{range['value']}",
            name=security_group_name,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # VSwitch Resource for Module
    vswitch = []
    for range in [{"value": i} for i in range(0, 1 if vswitch_id ==  else 0)]:
        vswitch.append(alicloud.vpc.Switch(f"vswitch-{range['value']}",
            availability_zone=default_get_instance_types.types[0].zone_id if availability_zone == "" else availability_zone,
            vswitch_name=vswitch_name,
            cidr_block=vswitch_cidr,
            vpc_id=vpc[0].id if vpc_id == "" else vpc_id))
    # Ram role Resource for Module
    default_role = alicloud.ram.Role("default",
        name=ram_name,
        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",
        name="terraform-gateway-cluster-test",
        emr_ver=default.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_get_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_get_instance_types.types[0].zone_id,
        security_group_id=default_security_group[0].id if security_group_id == "" else security_group_id,
        is_open_public_ip=True,
        charge_type="PostPaid",
        vswitch_id=vswitch[0].id if vswitch_id == "" else vswitch_id,
        user_defined_emr_ecs_role=default_role.name,
        ssh_enable=True,
        master_pwd="ABCtest1234!",
        related_cluster_id=related_cluster_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/emr"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _default, err := emr.GetMainVersions(ctx, nil, nil);
    if err != nil {
    return err
    }
    defaultGetInstanceTypes, err := emr.GetInstanceTypes(ctx, &emr.GetInstanceTypesArgs{
    DestinationResource: "InstanceType",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    SupportLocalStorage: pulumi.BoolRef(false),
    InstanceChargeType: "PostPaid",
    SupportNodeTypes: []string{
    "GATEWAY",
    },
    }, nil);
    if err != nil {
    return err
    }
    dataDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "DataDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    systemDisk, err := emr.GetDiskTypes(ctx, &emr.GetDiskTypesArgs{
    DestinationResource: "SystemDisk",
    ClusterType: _default.MainVersions[0].ClusterTypes[0],
    InstanceChargeType: "PostPaid",
    InstanceType: defaultGetInstanceTypes.Types[0].Id,
    ZoneId: pulumi.StringRef(defaultGetInstanceTypes.Types[0].ZoneId),
    }, nil);
    if err != nil {
    return err
    }
    var tmp0 float64
    if vpcId == "" {
    tmp0 = 1
    } else {
    tmp0 = 0
    }
    var vpc []*vpc.Network
    for index := 0; index < tmp0; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewNetwork(ctx, fmt.Sprintf("vpc-%v", key0), &vpc.NetworkArgs{
    Name: pulumi.Any(vpcName),
    CidrBlock: pulumi.Any(vpcCidr),
    })
    if err != nil {
    return err
    }
    vpc = append(vpc, __res)
    }
    var tmp1 pulumi.String
    if vpcId == "" {
    tmp1 = vpc[0].ID()
    } else {
    tmp1 = pulumi.Any(vpcId)
    }
    var tmp2 float64
    if securityGroupId == "" {
    tmp2 = 1
    } else {
    tmp2 = 0
    }
    var defaultSecurityGroup []*ecs.SecurityGroup
    for index := 0; index < tmp2; index++ {
        key0 := index
        _ := index
    __res, err := ecs.NewSecurityGroup(ctx, fmt.Sprintf("default-%v", key0), &ecs.SecurityGroupArgs{
    Name: pulumi.Any(securityGroupName),
    VpcId: pulumi.String(tmp1),
    })
    if err != nil {
    return err
    }
    defaultSecurityGroup = append(defaultSecurityGroup, __res)
    }
    var tmp3 pulumi.String
    if availabilityZone == "" {
    tmp3 = pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId)
    } else {
    tmp3 = pulumi.Any(availabilityZone)
    }
    var tmp4 pulumi.String
    if vpcId == "" {
    tmp4 = vpc[0].ID()
    } else {
    tmp4 = pulumi.Any(vpcId)
    }
    // VSwitch Resource for Module
    var tmp5 float64
    if vswitchId == "" {
    tmp5 = 1
    } else {
    tmp5 = 0
    }
    var vswitch []*vpc.Switch
    for index := 0; index < tmp5; index++ {
        key0 := index
        _ := index
    __res, err := vpc.NewSwitch(ctx, fmt.Sprintf("vswitch-%v", key0), &vpc.SwitchArgs{
    AvailabilityZone: pulumi.String(tmp3),
    VswitchName: pulumi.Any(vswitchName),
    CidrBlock: pulumi.Any(vswitchCidr),
    VpcId: pulumi.String(tmp4),
    })
    if err != nil {
    return err
    }
    vswitch = append(vswitch, __res)
    }
    // Ram role Resource for Module
    defaultRole, err := ram.NewRole(ctx, "default", &ram.RoleArgs{
    Name: pulumi.Any(ramName),
    Document: pulumi.String(`    {
            "Statement": [
            {
                "Action": "sts:AssumeRole",
                "Effect": "Allow",
                "Principal": {
                "Service": [
                    "emr.aliyuncs.com",
                    "ecs.aliyuncs.com"
                ]
                }
            }
            ],
            "Version": "1"
        }
    `),
    Description: pulumi.String("this is a role test."),
    Force: pulumi.Bool(true),
    })
    if err != nil {
    return err
    }
    var tmp6 pulumi.String
    if securityGroupId == "" {
    tmp6 = defaultSecurityGroup[0].ID()
    } else {
    tmp6 = pulumi.Any(securityGroupId)
    }
    var tmp7 pulumi.String
    if vswitchId == "" {
    tmp7 = vswitch[0].ID()
    } else {
    tmp7 = pulumi.Any(vswitchId)
    }
    _, err = emr.NewCluster(ctx, "gateway", &emr.ClusterArgs{
    Name: pulumi.String("terraform-gateway-cluster-test"),
    EmrVer: pulumi.String(_default.MainVersions[0].EmrVersion),
    ClusterType: pulumi.String("GATEWAY"),
    HostGroups: emr.ClusterHostGroupArray{
    var tmp8 pulumi.String
    if dataDisk.Types[0].Min > 160 {
    tmp8 = pulumi.Int(dataDisk.Types[0].Min)
    } else {
    tmp8 = pulumi.String("160")
    }
    var tmp9 pulumi.String
    if systemDisk.Types[0].Min > 160 {
    tmp9 = pulumi.Int(systemDisk.Types[0].Min)
    } else {
    tmp9 = pulumi.String("160")
    }
    &emr.ClusterHostGroupArgs{
    HostGroupName: pulumi.String("master_group"),
    HostGroupType: pulumi.String("GATEWAY"),
    NodeCount: pulumi.String("1"),
    InstanceType: pulumi.String(defaultGetInstanceTypes.Types[0].Id),
    DiskType: pulumi.String(dataDisk.Types[0].Value),
    DiskCapacity: pulumi.String(tmp8),
    DiskCount: pulumi.String("1"),
    SysDiskType: pulumi.String(systemDisk.Types[0].Value),
    SysDiskCapacity: pulumi.String(tmp9),
    },
    },
    HighAvailabilityEnable: pulumi.Bool(true),
    ZoneId: pulumi.String(defaultGetInstanceTypes.Types[0].ZoneId),
    SecurityGroupId: pulumi.String(tmp6),
    IsOpenPublicIp: pulumi.Bool(true),
    ChargeType: pulumi.String("PostPaid"),
    VswitchId: pulumi.String(tmp7),
    UserDefinedEmrEcsRole: defaultRole.Name,
    SshEnable: pulumi.Bool(true),
    MasterPwd: pulumi.String("ABCtest1234!"),
    RelatedClusterId: pulumi.Any(relatedClusterId),
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.Emr.GetMainVersions.Invoke();
    
        var defaultGetInstanceTypes = AliCloud.Emr.GetInstanceTypes.Invoke(new()
        {
            DestinationResource = "InstanceType",
            ClusterType = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            SupportLocalStorage = false,
            InstanceChargeType = "PostPaid",
            SupportNodeTypes = new[]
            {
                "GATEWAY",
            },
        });
    
        var dataDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
        {
            DestinationResource = "DataDisk",
            ClusterType = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var systemDisk = AliCloud.Emr.GetDiskTypes.Invoke(new()
        {
            DestinationResource = "SystemDisk",
            ClusterType = @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.ClusterTypes[0]),
            InstanceChargeType = "PostPaid",
            InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
            ZoneId = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
        });
    
        var vpc = new List<AliCloud.Vpc.Network>();
        for (var rangeIndex = 0; rangeIndex < (vpcId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vpc.Add(new AliCloud.Vpc.Network($"vpc-{range.Value}", new()
            {
                Name = vpcName,
                CidrBlock = vpcCidr,
            }));
        }
        var defaultSecurityGroup = new List<AliCloud.Ecs.SecurityGroup>();
        for (var rangeIndex = 0; rangeIndex < (securityGroupId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            defaultSecurityGroup.Add(new AliCloud.Ecs.SecurityGroup($"default-{range.Value}", new()
            {
                Name = securityGroupName,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // VSwitch Resource for Module
        var vswitch = new List<AliCloud.Vpc.Switch>();
        for (var rangeIndex = 0; rangeIndex < (vswitchId == "" ? 1 : 0); rangeIndex++)
        {
            var range = new { Value = rangeIndex };
            vswitch.Add(new AliCloud.Vpc.Switch($"vswitch-{range.Value}", new()
            {
                AvailabilityZone = availabilityZone == "" ? defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId) : availabilityZone,
                VswitchName = vswitchName,
                CidrBlock = vswitchCidr,
                VpcId = vpcId == "" ? vpc[0].Id : vpcId,
            }));
        }
        // Ram role Resource for Module
        var defaultRole = new AliCloud.Ram.Role("default", new()
        {
            Name = ramName,
            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()
        {
            Name = "terraform-gateway-cluster-test",
            EmrVer = @default.Apply(@default => @default.Apply(getMainVersionsResult => getMainVersionsResult.MainVersions[0]?.EmrVersion)),
            ClusterType = "GATEWAY",
            HostGroups = new[]
            {
                new AliCloud.Emr.Inputs.ClusterHostGroupArgs
                {
                    HostGroupName = "master_group",
                    HostGroupType = "GATEWAY",
                    NodeCount = "1",
                    InstanceType = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.Id),
                    DiskType = dataDisk.Apply(getDiskTypesResult => getDiskTypesResult.Types[0]?.Value),
                    DiskCapacity = Output.Tuple(dataDisk, dataDisk).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, systemDisk).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 = defaultGetInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.Types[0]?.ZoneId),
            SecurityGroupId = securityGroupId == "" ? defaultSecurityGroup[0].Id : securityGroupId,
            IsOpenPublicIp = true,
            ChargeType = "PostPaid",
            VswitchId = vswitchId == "" ? vswitch[0].Id : vswitchId,
            UserDefinedEmrEcsRole = defaultRole.Name,
            SshEnable = true,
            MasterPwd = "ABCtest1234!",
            RelatedClusterId = relatedClusterId,
        });
    
    });
    
    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 default = EmrFunctions.getMainVersions();
    
            final var defaultGetInstanceTypes = EmrFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
                .destinationResource("InstanceType")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .supportLocalStorage(false)
                .instanceChargeType("PostPaid")
                .supportNodeTypes("GATEWAY")
                .build());
    
            final var dataDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("DataDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            final var systemDisk = EmrFunctions.getDiskTypes(GetDiskTypesArgs.builder()
                .destinationResource("SystemDisk")
                .clusterType(default_.mainVersions()[0].clusterTypes()[0])
                .instanceChargeType("PostPaid")
                .instanceType(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].id()))
                .zoneId(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .build());
    
            for (var i = 0; i < (vpcId == "" ? 1 : 0); i++) {
                new Network("vpc-" + i, NetworkArgs.builder()
                    .name(vpcName)
                    .cidrBlock(vpcCidr)
                    .build());
    
            
    }
            for (var i = 0; i < (securityGroupId == "" ? 1 : 0); i++) {
                new SecurityGroup("defaultSecurityGroup-" + i, SecurityGroupArgs.builder()
                    .name(securityGroupName)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // VSwitch Resource for Module
            for (var i = 0; i < (vswitchId == "" ? 1 : 0); i++) {
                new Switch("vswitch-" + i, SwitchArgs.builder()
                    .availabilityZone(availabilityZone == "" ? defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()) : availabilityZone)
                    .vswitchName(vswitchName)
                    .cidrBlock(vswitchCidr)
                    .vpcId(vpcId == "" ? vpc[0].id() : vpcId)
                    .build());
    
            
    }
            // Ram role Resource for Module
            var defaultRole = new Role("defaultRole", RoleArgs.builder()
                .name(ramName)
                .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()
                .name("terraform-gateway-cluster-test")
                .emrVer(default_.mainVersions()[0].emrVersion())
                .clusterType("GATEWAY")
                .hostGroups(ClusterHostGroupArgs.builder()
                    .hostGroupName("master_group")
                    .hostGroupType("GATEWAY")
                    .nodeCount("1")
                    .instanceType(defaultGetInstanceTypes.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(defaultGetInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.types()[0].zoneId()))
                .securityGroupId(securityGroupId == "" ? defaultSecurityGroup[0].id() : securityGroupId)
                .isOpenPublicIp(true)
                .chargeType("PostPaid")
                .vswitchId(vswitchId == "" ? vswitch[0].id() : vswitchId)
                .userDefinedEmrEcsRole(defaultRole.name())
                .sshEnable(true)
                .masterPwd("ABCtest1234!")
                .relatedClusterId(relatedClusterId)
                .build());
    
        }
    }
    
    Coming soon!
    

    Create Cluster Resource

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

    Constructor syntax

    new Cluster(name: string, args: ClusterArgs, opts?: CustomResourceOptions);
    @overload
    def Cluster(resource_name: str,
                args: ClusterArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Cluster(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                emr_ver: Optional[str] = None,
                zone_id: Optional[str] = None,
                cluster_type: Optional[str] = None,
                meta_store_conf: Optional[ClusterMetaStoreConfArgs] = None,
                modify_cluster_service_config: Optional[ClusterModifyClusterServiceConfigArgs] = None,
                eas_enable: Optional[bool] = None,
                configs: Optional[Sequence[ClusterConfigArgs]] = 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,
                bootstrap_actions: Optional[Sequence[ClusterBootstrapActionArgs]] = None,
                meta_store_type: Optional[str] = None,
                deposit_type: Optional[str] = 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,
                charge_type: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

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

    var exampleclusterResourceResourceFromEmrcluster = new AliCloud.Emr.Cluster("exampleclusterResourceResourceFromEmrcluster", new()
    {
        EmrVer = "string",
        ZoneId = "string",
        ClusterType = "string",
        MetaStoreConf = new AliCloud.Emr.Inputs.ClusterMetaStoreConfArgs
        {
            DbPassword = "string",
            DbUrl = "string",
            DbUserName = "string",
        },
        ModifyClusterServiceConfig = new AliCloud.Emr.Inputs.ClusterModifyClusterServiceConfigArgs
        {
            ConfigParams = "string",
            ServiceName = "string",
            Comment = "string",
            ConfigType = "string",
            CustomConfigParams = "string",
            GatewayClusterIdLists = new[]
            {
                "string",
            },
            GroupId = "string",
            HostInstanceId = "string",
            RefreshHostConfig = false,
        },
        EasEnable = false,
        Configs = new[]
        {
            new AliCloud.Emr.Inputs.ClusterConfigArgs
            {
                ConfigKey = "string",
                ConfigValue = "string",
                FileName = "string",
                ServiceName = "string",
            },
        },
        HighAvailabilityEnable = false,
        HostGroups = new[]
        {
            new AliCloud.Emr.Inputs.ClusterHostGroupArgs
            {
                AutoRenew = false,
                ChargeType = "string",
                DecommissionTimeout = 0,
                DiskCapacity = "string",
                DiskCount = "string",
                DiskType = "string",
                EnableGracefulDecommission = false,
                GpuDriver = "string",
                HostGroupName = "string",
                HostGroupType = "string",
                InstanceList = "string",
                InstanceType = "string",
                NodeCount = "string",
                Period = 0,
                SysDiskCapacity = "string",
                SysDiskType = "string",
            },
        },
        IsOpenPublicIp = false,
        KeyPairName = "string",
        MasterPwd = "string",
        BootstrapActions = new[]
        {
            new AliCloud.Emr.Inputs.ClusterBootstrapActionArgs
            {
                Arg = "string",
                ExecutionFailStrategy = "string",
                ExecutionMoment = "string",
                ExecutionTarget = "string",
                Name = "string",
                Path = "string",
            },
        },
        MetaStoreType = "string",
        DepositType = "string",
        Name = "string",
        OptionSoftwareLists = new[]
        {
            "string",
        },
        Period = 0,
        RelatedClusterId = "string",
        ResourceGroupId = "string",
        SecurityGroupId = "string",
        SshEnable = false,
        Tags = 
        {
            { "string", "any" },
        },
        UseLocalMetadb = false,
        UserDefinedEmrEcsRole = "string",
        VswitchId = "string",
        ChargeType = "string",
    });
    
    example, err := emr.NewCluster(ctx, "exampleclusterResourceResourceFromEmrcluster", &emr.ClusterArgs{
    	EmrVer:      pulumi.String("string"),
    	ZoneId:      pulumi.String("string"),
    	ClusterType: pulumi.String("string"),
    	MetaStoreConf: &emr.ClusterMetaStoreConfArgs{
    		DbPassword: pulumi.String("string"),
    		DbUrl:      pulumi.String("string"),
    		DbUserName: pulumi.String("string"),
    	},
    	ModifyClusterServiceConfig: &emr.ClusterModifyClusterServiceConfigArgs{
    		ConfigParams:       pulumi.String("string"),
    		ServiceName:        pulumi.String("string"),
    		Comment:            pulumi.String("string"),
    		ConfigType:         pulumi.String("string"),
    		CustomConfigParams: pulumi.String("string"),
    		GatewayClusterIdLists: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		GroupId:           pulumi.String("string"),
    		HostInstanceId:    pulumi.String("string"),
    		RefreshHostConfig: pulumi.Bool(false),
    	},
    	EasEnable: pulumi.Bool(false),
    	Configs: emr.ClusterConfigArray{
    		&emr.ClusterConfigArgs{
    			ConfigKey:   pulumi.String("string"),
    			ConfigValue: pulumi.String("string"),
    			FileName:    pulumi.String("string"),
    			ServiceName: pulumi.String("string"),
    		},
    	},
    	HighAvailabilityEnable: pulumi.Bool(false),
    	HostGroups: emr.ClusterHostGroupArray{
    		&emr.ClusterHostGroupArgs{
    			AutoRenew:                  pulumi.Bool(false),
    			ChargeType:                 pulumi.String("string"),
    			DecommissionTimeout:        pulumi.Int(0),
    			DiskCapacity:               pulumi.String("string"),
    			DiskCount:                  pulumi.String("string"),
    			DiskType:                   pulumi.String("string"),
    			EnableGracefulDecommission: pulumi.Bool(false),
    			GpuDriver:                  pulumi.String("string"),
    			HostGroupName:              pulumi.String("string"),
    			HostGroupType:              pulumi.String("string"),
    			InstanceList:               pulumi.String("string"),
    			InstanceType:               pulumi.String("string"),
    			NodeCount:                  pulumi.String("string"),
    			Period:                     pulumi.Int(0),
    			SysDiskCapacity:            pulumi.String("string"),
    			SysDiskType:                pulumi.String("string"),
    		},
    	},
    	IsOpenPublicIp: pulumi.Bool(false),
    	KeyPairName:    pulumi.String("string"),
    	MasterPwd:      pulumi.String("string"),
    	BootstrapActions: emr.ClusterBootstrapActionArray{
    		&emr.ClusterBootstrapActionArgs{
    			Arg:                   pulumi.String("string"),
    			ExecutionFailStrategy: pulumi.String("string"),
    			ExecutionMoment:       pulumi.String("string"),
    			ExecutionTarget:       pulumi.String("string"),
    			Name:                  pulumi.String("string"),
    			Path:                  pulumi.String("string"),
    		},
    	},
    	MetaStoreType: pulumi.String("string"),
    	DepositType:   pulumi.String("string"),
    	Name:          pulumi.String("string"),
    	OptionSoftwareLists: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Period:           pulumi.Int(0),
    	RelatedClusterId: pulumi.String("string"),
    	ResourceGroupId:  pulumi.String("string"),
    	SecurityGroupId:  pulumi.String("string"),
    	SshEnable:        pulumi.Bool(false),
    	Tags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	UseLocalMetadb:        pulumi.Bool(false),
    	UserDefinedEmrEcsRole: pulumi.String("string"),
    	VswitchId:             pulumi.String("string"),
    	ChargeType:            pulumi.String("string"),
    })
    
    var exampleclusterResourceResourceFromEmrcluster = new Cluster("exampleclusterResourceResourceFromEmrcluster", ClusterArgs.builder()
        .emrVer("string")
        .zoneId("string")
        .clusterType("string")
        .metaStoreConf(ClusterMetaStoreConfArgs.builder()
            .dbPassword("string")
            .dbUrl("string")
            .dbUserName("string")
            .build())
        .modifyClusterServiceConfig(ClusterModifyClusterServiceConfigArgs.builder()
            .configParams("string")
            .serviceName("string")
            .comment("string")
            .configType("string")
            .customConfigParams("string")
            .gatewayClusterIdLists("string")
            .groupId("string")
            .hostInstanceId("string")
            .refreshHostConfig(false)
            .build())
        .easEnable(false)
        .configs(ClusterConfigArgs.builder()
            .configKey("string")
            .configValue("string")
            .fileName("string")
            .serviceName("string")
            .build())
        .highAvailabilityEnable(false)
        .hostGroups(ClusterHostGroupArgs.builder()
            .autoRenew(false)
            .chargeType("string")
            .decommissionTimeout(0)
            .diskCapacity("string")
            .diskCount("string")
            .diskType("string")
            .enableGracefulDecommission(false)
            .gpuDriver("string")
            .hostGroupName("string")
            .hostGroupType("string")
            .instanceList("string")
            .instanceType("string")
            .nodeCount("string")
            .period(0)
            .sysDiskCapacity("string")
            .sysDiskType("string")
            .build())
        .isOpenPublicIp(false)
        .keyPairName("string")
        .masterPwd("string")
        .bootstrapActions(ClusterBootstrapActionArgs.builder()
            .arg("string")
            .executionFailStrategy("string")
            .executionMoment("string")
            .executionTarget("string")
            .name("string")
            .path("string")
            .build())
        .metaStoreType("string")
        .depositType("string")
        .name("string")
        .optionSoftwareLists("string")
        .period(0)
        .relatedClusterId("string")
        .resourceGroupId("string")
        .securityGroupId("string")
        .sshEnable(false)
        .tags(Map.of("string", "any"))
        .useLocalMetadb(false)
        .userDefinedEmrEcsRole("string")
        .vswitchId("string")
        .chargeType("string")
        .build());
    
    examplecluster_resource_resource_from_emrcluster = alicloud.emr.Cluster("exampleclusterResourceResourceFromEmrcluster",
        emr_ver="string",
        zone_id="string",
        cluster_type="string",
        meta_store_conf=alicloud.emr.ClusterMetaStoreConfArgs(
            db_password="string",
            db_url="string",
            db_user_name="string",
        ),
        modify_cluster_service_config=alicloud.emr.ClusterModifyClusterServiceConfigArgs(
            config_params="string",
            service_name="string",
            comment="string",
            config_type="string",
            custom_config_params="string",
            gateway_cluster_id_lists=["string"],
            group_id="string",
            host_instance_id="string",
            refresh_host_config=False,
        ),
        eas_enable=False,
        configs=[alicloud.emr.ClusterConfigArgs(
            config_key="string",
            config_value="string",
            file_name="string",
            service_name="string",
        )],
        high_availability_enable=False,
        host_groups=[alicloud.emr.ClusterHostGroupArgs(
            auto_renew=False,
            charge_type="string",
            decommission_timeout=0,
            disk_capacity="string",
            disk_count="string",
            disk_type="string",
            enable_graceful_decommission=False,
            gpu_driver="string",
            host_group_name="string",
            host_group_type="string",
            instance_list="string",
            instance_type="string",
            node_count="string",
            period=0,
            sys_disk_capacity="string",
            sys_disk_type="string",
        )],
        is_open_public_ip=False,
        key_pair_name="string",
        master_pwd="string",
        bootstrap_actions=[alicloud.emr.ClusterBootstrapActionArgs(
            arg="string",
            execution_fail_strategy="string",
            execution_moment="string",
            execution_target="string",
            name="string",
            path="string",
        )],
        meta_store_type="string",
        deposit_type="string",
        name="string",
        option_software_lists=["string"],
        period=0,
        related_cluster_id="string",
        resource_group_id="string",
        security_group_id="string",
        ssh_enable=False,
        tags={
            "string": "any",
        },
        use_local_metadb=False,
        user_defined_emr_ecs_role="string",
        vswitch_id="string",
        charge_type="string")
    
    const exampleclusterResourceResourceFromEmrcluster = new alicloud.emr.Cluster("exampleclusterResourceResourceFromEmrcluster", {
        emrVer: "string",
        zoneId: "string",
        clusterType: "string",
        metaStoreConf: {
            dbPassword: "string",
            dbUrl: "string",
            dbUserName: "string",
        },
        modifyClusterServiceConfig: {
            configParams: "string",
            serviceName: "string",
            comment: "string",
            configType: "string",
            customConfigParams: "string",
            gatewayClusterIdLists: ["string"],
            groupId: "string",
            hostInstanceId: "string",
            refreshHostConfig: false,
        },
        easEnable: false,
        configs: [{
            configKey: "string",
            configValue: "string",
            fileName: "string",
            serviceName: "string",
        }],
        highAvailabilityEnable: false,
        hostGroups: [{
            autoRenew: false,
            chargeType: "string",
            decommissionTimeout: 0,
            diskCapacity: "string",
            diskCount: "string",
            diskType: "string",
            enableGracefulDecommission: false,
            gpuDriver: "string",
            hostGroupName: "string",
            hostGroupType: "string",
            instanceList: "string",
            instanceType: "string",
            nodeCount: "string",
            period: 0,
            sysDiskCapacity: "string",
            sysDiskType: "string",
        }],
        isOpenPublicIp: false,
        keyPairName: "string",
        masterPwd: "string",
        bootstrapActions: [{
            arg: "string",
            executionFailStrategy: "string",
            executionMoment: "string",
            executionTarget: "string",
            name: "string",
            path: "string",
        }],
        metaStoreType: "string",
        depositType: "string",
        name: "string",
        optionSoftwareLists: ["string"],
        period: 0,
        relatedClusterId: "string",
        resourceGroupId: "string",
        securityGroupId: "string",
        sshEnable: false,
        tags: {
            string: "any",
        },
        useLocalMetadb: false,
        userDefinedEmrEcsRole: "string",
        vswitchId: "string",
        chargeType: "string",
    });
    
    type: alicloud:emr:Cluster
    properties:
        bootstrapActions:
            - arg: string
              executionFailStrategy: string
              executionMoment: string
              executionTarget: string
              name: string
              path: string
        chargeType: string
        clusterType: string
        configs:
            - configKey: string
              configValue: string
              fileName: string
              serviceName: string
        depositType: string
        easEnable: false
        emrVer: string
        highAvailabilityEnable: false
        hostGroups:
            - autoRenew: false
              chargeType: string
              decommissionTimeout: 0
              diskCapacity: string
              diskCount: string
              diskType: string
              enableGracefulDecommission: false
              gpuDriver: string
              hostGroupName: string
              hostGroupType: string
              instanceList: string
              instanceType: string
              nodeCount: string
              period: 0
              sysDiskCapacity: string
              sysDiskType: string
        isOpenPublicIp: false
        keyPairName: string
        masterPwd: string
        metaStoreConf:
            dbPassword: string
            dbUrl: string
            dbUserName: string
        metaStoreType: string
        modifyClusterServiceConfig:
            comment: string
            configParams: string
            configType: string
            customConfigParams: string
            gatewayClusterIdLists:
                - string
            groupId: string
            hostInstanceId: string
            refreshHostConfig: false
            serviceName: string
        name: string
        optionSoftwareLists:
            - string
        period: 0
        relatedClusterId: string
        resourceGroupId: string
        securityGroupId: string
        sshEnable: false
        tags:
            string: any
        useLocalMetadb: false
        userDefinedEmrEcsRole: string
        vswitchId: string
        zoneId: string
    

    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.ClusterBootstrapAction>
    Boot action parameters.
    ChargeType string
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    Configs List<Pulumi.AliCloud.Emr.Inputs.ClusterConfig>
    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.ClusterHostGroup>
    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.ClusterMetaStoreConf
    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.ClusterModifyClusterServiceConfig
    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<ClusterBootstrapAction>
    Boot action parameters.
    chargeType String
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    configs List<ClusterConfig>
    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<ClusterHostGroup>
    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 ClusterMetaStoreConf
    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 ClusterModifyClusterServiceConfig
    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 ClusterBootstrapAction[]
    Boot action parameters.
    chargeType string
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    configs ClusterConfig[]
    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 ClusterHostGroup[]
    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 ClusterMetaStoreConf
    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 ClusterModifyClusterServiceConfig
    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.ClusterBootstrapAction>
    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.ClusterConfig>
    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.ClusterHostGroup>
    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.ClusterMetaStoreConf
    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.ClusterModifyClusterServiceConfig
    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<ClusterBootstrapAction>
    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<ClusterConfig>
    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<ClusterHostGroup>
    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 ClusterMetaStoreConf
    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 ClusterModifyClusterServiceConfig
    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 ClusterBootstrapAction[]
    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 ClusterConfig[]
    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 ClusterHostGroup[]
    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 ClusterMetaStoreConf
    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 ClusterModifyClusterServiceConfig
    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, ClusterBootstrapActionArgs

    Arg string
    ExecutionFailStrategy string
    ExecutionMoment string
    ExecutionTarget string
    Name string
    The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".
    Path string
    Arg string
    ExecutionFailStrategy string
    ExecutionMoment string
    ExecutionTarget string
    Name string
    The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".
    Path string
    arg String
    executionFailStrategy String
    executionMoment String
    executionTarget String
    name String
    The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".
    path String
    arg string
    executionFailStrategy string
    executionMoment string
    executionTarget string
    name string
    The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".
    path string
    arg str
    execution_fail_strategy str
    execution_moment str
    execution_target str
    name str
    The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".
    path str
    arg String
    executionFailStrategy String
    executionMoment String
    executionTarget String
    name String
    The name of emr cluster. The name length must be less than 64. Supported characters: chinese character, english character, number, "-", "_".
    path String

    ClusterConfig, ClusterConfigArgs

    ConfigKey string
    ConfigValue string
    FileName string
    ServiceName string
    ConfigKey string
    ConfigValue string
    FileName string
    ServiceName string
    configKey String
    configValue String
    fileName String
    serviceName String
    configKey string
    configValue string
    fileName string
    serviceName string
    configKey String
    configValue String
    fileName String
    serviceName String

    ClusterHostGroup, ClusterHostGroupArgs

    AutoRenew bool
    ChargeType string
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    DecommissionTimeout int
    DiskCapacity string
    DiskCount string
    DiskType string
    EnableGracefulDecommission bool
    GpuDriver string
    HostGroupName string
    HostGroupType string
    InstanceList string
    InstanceType string
    NodeCount string
    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
    SysDiskType string
    AutoRenew bool
    ChargeType string
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    DecommissionTimeout int
    DiskCapacity string
    DiskCount string
    DiskType string
    EnableGracefulDecommission bool
    GpuDriver string
    HostGroupName string
    HostGroupType string
    InstanceList string
    InstanceType string
    NodeCount string
    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
    SysDiskType string
    autoRenew Boolean
    chargeType String
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    decommissionTimeout Integer
    diskCapacity String
    diskCount String
    diskType String
    enableGracefulDecommission Boolean
    gpuDriver String
    hostGroupName String
    hostGroupType String
    instanceList String
    instanceType String
    nodeCount String
    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
    sysDiskType String
    autoRenew boolean
    chargeType string
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    decommissionTimeout number
    diskCapacity string
    diskCount string
    diskType string
    enableGracefulDecommission boolean
    gpuDriver string
    hostGroupName string
    hostGroupType string
    instanceList string
    instanceType string
    nodeCount string
    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
    sysDiskType string
    auto_renew bool
    charge_type str
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    decommission_timeout int
    disk_capacity str
    disk_count str
    disk_type str
    enable_graceful_decommission bool
    gpu_driver str
    host_group_name str
    host_group_type str
    instance_list str
    instance_type str
    node_count str
    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
    sys_disk_type str
    autoRenew Boolean
    chargeType String
    Charge Type for this cluster. Supported value: PostPaid or PrePaid. Default value: PostPaid.
    decommissionTimeout Number
    diskCapacity String
    diskCount String
    diskType String
    enableGracefulDecommission Boolean
    gpuDriver String
    hostGroupName String
    hostGroupType String
    instanceList String
    instanceType String
    nodeCount String
    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
    sysDiskType String

    ClusterMetaStoreConf, ClusterMetaStoreConfArgs

    DbPassword string
    DbUrl string
    DbUserName string
    DbPassword string
    DbUrl string
    DbUserName string
    dbPassword String
    dbUrl String
    dbUserName String
    dbPassword string
    dbUrl string
    dbUserName string
    dbPassword String
    dbUrl String
    dbUserName String

    ClusterModifyClusterServiceConfig, ClusterModifyClusterServiceConfigArgs

    Import

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

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

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

    Package Details

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