1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. adb
  5. ResourceGroup
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

alicloud.adb.ResourceGroup

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

    Provides a AnalyticDB for MySQL (ADB) Resource Group resource.

    For information about AnalyticDB for MySQL (ADB) Resource Group and how to use it, see What is Resource Group.

    NOTE: Available since v1.195.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const default = alicloud.adb.getZones({});
    const defaultNetwork = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "192.168.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vswitchName: name,
        vpcId: defaultNetwork.id,
        cidrBlock: "192.168.192.0/24",
        zoneId: _default.then(_default => _default.zones?.[0]?.id),
    });
    const defaultDBCluster = new alicloud.adb.DBCluster("default", {
        computeResource: "32Core128GB",
        dbClusterCategory: "MixedStorage",
        description: name,
        elasticIoResource: 1,
        mode: "flexible",
        paymentType: "PayAsYouGo",
        vpcId: defaultNetwork.id,
        vswitchId: defaultSwitch.id,
        zoneId: _default.then(_default => _default.zones?.[0]?.id),
    });
    const defaultResourceGroup = new alicloud.adb.ResourceGroup("default", {
        dbClusterId: defaultDBCluster.id,
        groupName: name,
        groupType: "batch",
        nodeNum: 1,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.adb.get_zones()
    default_network = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="192.168.0.0/16")
    default_switch = alicloud.vpc.Switch("default",
        vswitch_name=name,
        vpc_id=default_network.id,
        cidr_block="192.168.192.0/24",
        zone_id=default.zones[0].id)
    default_db_cluster = alicloud.adb.DBCluster("default",
        compute_resource="32Core128GB",
        db_cluster_category="MixedStorage",
        description=name,
        elastic_io_resource=1,
        mode="flexible",
        payment_type="PayAsYouGo",
        vpc_id=default_network.id,
        vswitch_id=default_switch.id,
        zone_id=default.zones[0].id)
    default_resource_group = alicloud.adb.ResourceGroup("default",
        db_cluster_id=default_db_cluster.id,
        group_name=name,
        group_type="batch",
        node_num=1)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/adb"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := adb.GetZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("192.168.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VswitchName: pulumi.String(name),
    			VpcId:       defaultNetwork.ID(),
    			CidrBlock:   pulumi.String("192.168.192.0/24"),
    			ZoneId:      pulumi.String(_default.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		defaultDBCluster, err := adb.NewDBCluster(ctx, "default", &adb.DBClusterArgs{
    			ComputeResource:   pulumi.String("32Core128GB"),
    			DbClusterCategory: pulumi.String("MixedStorage"),
    			Description:       pulumi.String(name),
    			ElasticIoResource: pulumi.Int(1),
    			Mode:              pulumi.String("flexible"),
    			PaymentType:       pulumi.String("PayAsYouGo"),
    			VpcId:             defaultNetwork.ID(),
    			VswitchId:         defaultSwitch.ID(),
    			ZoneId:            pulumi.String(_default.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = adb.NewResourceGroup(ctx, "default", &adb.ResourceGroupArgs{
    			DbClusterId: defaultDBCluster.ID(),
    			GroupName:   pulumi.String(name),
    			GroupType:   pulumi.String("batch"),
    			NodeNum:     pulumi.Int(1),
    		})
    		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 config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = AliCloud.Adb.GetZones.Invoke();
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "192.168.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VswitchName = name,
            VpcId = defaultNetwork.Id,
            CidrBlock = "192.168.192.0/24",
            ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
        });
    
        var defaultDBCluster = new AliCloud.Adb.DBCluster("default", new()
        {
            ComputeResource = "32Core128GB",
            DbClusterCategory = "MixedStorage",
            Description = name,
            ElasticIoResource = 1,
            Mode = "flexible",
            PaymentType = "PayAsYouGo",
            VpcId = defaultNetwork.Id,
            VswitchId = defaultSwitch.Id,
            ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
        });
    
        var defaultResourceGroup = new AliCloud.Adb.ResourceGroup("default", new()
        {
            DbClusterId = defaultDBCluster.Id,
            GroupName = name,
            GroupType = "batch",
            NodeNum = 1,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.adb.AdbFunctions;
    import com.pulumi.alicloud.adb.inputs.GetZonesArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.adb.DBCluster;
    import com.pulumi.alicloud.adb.DBClusterArgs;
    import com.pulumi.alicloud.adb.ResourceGroup;
    import com.pulumi.alicloud.adb.ResourceGroupArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var default = AdbFunctions.getZones();
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .vpcName(name)
                .cidrBlock("192.168.0.0/16")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
                .vswitchName(name)
                .vpcId(defaultNetwork.id())
                .cidrBlock("192.168.192.0/24")
                .zoneId(default_.zones()[0].id())
                .build());
    
            var defaultDBCluster = new DBCluster("defaultDBCluster", DBClusterArgs.builder()
                .computeResource("32Core128GB")
                .dbClusterCategory("MixedStorage")
                .description(name)
                .elasticIoResource(1)
                .mode("flexible")
                .paymentType("PayAsYouGo")
                .vpcId(defaultNetwork.id())
                .vswitchId(defaultSwitch.id())
                .zoneId(default_.zones()[0].id())
                .build());
    
            var defaultResourceGroup = new ResourceGroup("defaultResourceGroup", ResourceGroupArgs.builder()
                .dbClusterId(defaultDBCluster.id())
                .groupName(name)
                .groupType("batch")
                .nodeNum(1)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        name: default
        properties:
          vpcName: ${name}
          cidrBlock: 192.168.0.0/16
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vswitchName: ${name}
          vpcId: ${defaultNetwork.id}
          cidrBlock: 192.168.192.0/24
          zoneId: ${default.zones[0].id}
      defaultDBCluster:
        type: alicloud:adb:DBCluster
        name: default
        properties:
          computeResource: 32Core128GB
          dbClusterCategory: MixedStorage
          description: ${name}
          elasticIoResource: 1
          mode: flexible
          paymentType: PayAsYouGo
          vpcId: ${defaultNetwork.id}
          vswitchId: ${defaultSwitch.id}
          zoneId: ${default.zones[0].id}
      defaultResourceGroup:
        type: alicloud:adb:ResourceGroup
        name: default
        properties:
          dbClusterId: ${defaultDBCluster.id}
          groupName: ${name}
          groupType: batch
          nodeNum: 1
    variables:
      default:
        fn::invoke:
          Function: alicloud:adb:getZones
          Arguments: {}
    

    Create ResourceGroup Resource

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

    Constructor syntax

    new ResourceGroup(name: string, args: ResourceGroupArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceGroup(resource_name: str,
                      args: ResourceGroupArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceGroup(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      db_cluster_id: Optional[str] = None,
                      group_name: Optional[str] = None,
                      group_type: Optional[str] = None,
                      node_num: Optional[int] = None,
                      users: Optional[Sequence[str]] = None)
    func NewResourceGroup(ctx *Context, name string, args ResourceGroupArgs, opts ...ResourceOption) (*ResourceGroup, error)
    public ResourceGroup(string name, ResourceGroupArgs args, CustomResourceOptions? opts = null)
    public ResourceGroup(String name, ResourceGroupArgs args)
    public ResourceGroup(String name, ResourceGroupArgs args, CustomResourceOptions options)
    
    type: alicloud:adb:ResourceGroup
    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 ResourceGroupArgs
    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 ResourceGroupArgs
    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 ResourceGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceGroupArgs
    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 resourceGroupResource = new AliCloud.Adb.ResourceGroup("resourceGroupResource", new()
    {
        DbClusterId = "string",
        GroupName = "string",
        GroupType = "string",
        NodeNum = 0,
        Users = new[]
        {
            "string",
        },
    });
    
    example, err := adb.NewResourceGroup(ctx, "resourceGroupResource", &adb.ResourceGroupArgs{
    	DbClusterId: pulumi.String("string"),
    	GroupName:   pulumi.String("string"),
    	GroupType:   pulumi.String("string"),
    	NodeNum:     pulumi.Int(0),
    	Users: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var resourceGroupResource = new ResourceGroup("resourceGroupResource", ResourceGroupArgs.builder()
        .dbClusterId("string")
        .groupName("string")
        .groupType("string")
        .nodeNum(0)
        .users("string")
        .build());
    
    resource_group_resource = alicloud.adb.ResourceGroup("resourceGroupResource",
        db_cluster_id="string",
        group_name="string",
        group_type="string",
        node_num=0,
        users=["string"])
    
    const resourceGroupResource = new alicloud.adb.ResourceGroup("resourceGroupResource", {
        dbClusterId: "string",
        groupName: "string",
        groupType: "string",
        nodeNum: 0,
        users: ["string"],
    });
    
    type: alicloud:adb:ResourceGroup
    properties:
        dbClusterId: string
        groupName: string
        groupType: string
        nodeNum: 0
        users:
            - string
    

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

    DbClusterId string
    The ID of the DBCluster.
    GroupName string
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    GroupType string
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    NodeNum int
    The number of nodes.
    Users List<string>
    The database accounts with which to associate the resource group.
    DbClusterId string
    The ID of the DBCluster.
    GroupName string
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    GroupType string
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    NodeNum int
    The number of nodes.
    Users []string
    The database accounts with which to associate the resource group.
    dbClusterId String
    The ID of the DBCluster.
    groupName String
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    groupType String
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    nodeNum Integer
    The number of nodes.
    users List<String>
    The database accounts with which to associate the resource group.
    dbClusterId string
    The ID of the DBCluster.
    groupName string
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    groupType string
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    nodeNum number
    The number of nodes.
    users string[]
    The database accounts with which to associate the resource group.
    db_cluster_id str
    The ID of the DBCluster.
    group_name str
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    group_type str
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    node_num int
    The number of nodes.
    users Sequence[str]
    The database accounts with which to associate the resource group.
    dbClusterId String
    The ID of the DBCluster.
    groupName String
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    groupType String
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    nodeNum Number
    The number of nodes.
    users List<String>
    The database accounts with which to associate the resource group.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ResourceGroup resource produces the following output properties:

    CreateTime string
    The time when the resource group was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdateTime string
    The time when the resource group was updated.
    User string
    The database accounts that are associated with the resource group.
    CreateTime string
    The time when the resource group was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdateTime string
    The time when the resource group was updated.
    User string
    The database accounts that are associated with the resource group.
    createTime String
    The time when the resource group was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updateTime String
    The time when the resource group was updated.
    user String
    The database accounts that are associated with the resource group.
    createTime string
    The time when the resource group was created.
    id string
    The provider-assigned unique ID for this managed resource.
    updateTime string
    The time when the resource group was updated.
    user string
    The database accounts that are associated with the resource group.
    create_time str
    The time when the resource group was created.
    id str
    The provider-assigned unique ID for this managed resource.
    update_time str
    The time when the resource group was updated.
    user str
    The database accounts that are associated with the resource group.
    createTime String
    The time when the resource group was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updateTime String
    The time when the resource group was updated.
    user String
    The database accounts that are associated with the resource group.

    Look up Existing ResourceGroup Resource

    Get an existing ResourceGroup 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?: ResourceGroupState, opts?: CustomResourceOptions): ResourceGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            db_cluster_id: Optional[str] = None,
            group_name: Optional[str] = None,
            group_type: Optional[str] = None,
            node_num: Optional[int] = None,
            update_time: Optional[str] = None,
            user: Optional[str] = None,
            users: Optional[Sequence[str]] = None) -> ResourceGroup
    func GetResourceGroup(ctx *Context, name string, id IDInput, state *ResourceGroupState, opts ...ResourceOption) (*ResourceGroup, error)
    public static ResourceGroup Get(string name, Input<string> id, ResourceGroupState? state, CustomResourceOptions? opts = null)
    public static ResourceGroup get(String name, Output<String> id, ResourceGroupState 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:
    CreateTime string
    The time when the resource group was created.
    DbClusterId string
    The ID of the DBCluster.
    GroupName string
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    GroupType string
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    NodeNum int
    The number of nodes.
    UpdateTime string
    The time when the resource group was updated.
    User string
    The database accounts that are associated with the resource group.
    Users List<string>
    The database accounts with which to associate the resource group.
    CreateTime string
    The time when the resource group was created.
    DbClusterId string
    The ID of the DBCluster.
    GroupName string
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    GroupType string
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    NodeNum int
    The number of nodes.
    UpdateTime string
    The time when the resource group was updated.
    User string
    The database accounts that are associated with the resource group.
    Users []string
    The database accounts with which to associate the resource group.
    createTime String
    The time when the resource group was created.
    dbClusterId String
    The ID of the DBCluster.
    groupName String
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    groupType String
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    nodeNum Integer
    The number of nodes.
    updateTime String
    The time when the resource group was updated.
    user String
    The database accounts that are associated with the resource group.
    users List<String>
    The database accounts with which to associate the resource group.
    createTime string
    The time when the resource group was created.
    dbClusterId string
    The ID of the DBCluster.
    groupName string
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    groupType string
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    nodeNum number
    The number of nodes.
    updateTime string
    The time when the resource group was updated.
    user string
    The database accounts that are associated with the resource group.
    users string[]
    The database accounts with which to associate the resource group.
    create_time str
    The time when the resource group was created.
    db_cluster_id str
    The ID of the DBCluster.
    group_name str
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    group_type str
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    node_num int
    The number of nodes.
    update_time str
    The time when the resource group was updated.
    user str
    The database accounts that are associated with the resource group.
    users Sequence[str]
    The database accounts with which to associate the resource group.
    createTime String
    The time when the resource group was created.
    dbClusterId String
    The ID of the DBCluster.
    groupName String
    The name of the resource group. The group_name can be up to 255 characters in length and can contain digits, uppercase letters, hyphens (-), and underscores (_). It must start with a digit or uppercase letter.
    groupType String
    The query execution mode. Default value: interactive. Valid values: interactive, batch.
    nodeNum Number
    The number of nodes.
    updateTime String
    The time when the resource group was updated.
    user String
    The database accounts that are associated with the resource group.
    users List<String>
    The database accounts with which to associate the resource group.

    Import

    Adb Resource Group can be imported using the id, e.g.

    $ pulumi import alicloud:adb/resourceGroup:ResourceGroup example <db_cluster_id>:<group_name>
    

    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.59.0 published on Friday, Jul 12, 2024 by Pulumi