1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. polardb
  5. ZonalAccount
Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi

alicloud.polardb.ZonalAccount

Start a Neo task
Explain and create an alicloud.polardb.ZonalAccount resource
alicloud logo
Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi

    Provides a PolarDB Zonal account resource and used to manage databases.

    NOTE: Available since v1.262.0.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    // The advanced configuration for all nodes in the cluster except for the RW node, including db_node_class, hot_replica_mode, and imci_switch properties.
    const dbClusterNodesConfigs = config.getObject<Record<string, {dbNodeClass?: string, dbNodeRole?: string, hotReplicaMode?: string, imciSwitch?: string}>>("dbClusterNodesConfigs") || {
        db_node_1: {
            dbNodeClass: "polar.mysql.x4.medium.c",
            dbNodeRole: "Writer",
            hotReplicaMode: null,
            imciSwitch: null,
        },
    };
    const _default = new alicloud.ens.Network("default", {
        networkName: "terraform-example",
        description: "LoadBalancerNetworkDescription_test",
        cidrBlock: "192.168.2.0/24",
        ensRegionId: "tr-Istanbul-1",
    });
    const defaultVswitch = new alicloud.ens.Vswitch("default", {
        description: "LoadBalancerVSwitchDescription_test",
        cidrBlock: "192.168.2.0/24",
        vswitchName: "terraform-example",
        ensRegionId: "tr-Istanbul-1",
        networkId: _default.id,
    });
    const defaultZonalDbCluster = new alicloud.polardb.ZonalDbCluster("default", {
        dbNodeClass: "polar.mysql.x4.medium.c",
        description: "terraform-example",
        ensRegionId: "tr-Istanbul-1",
        vpcId: _default.id,
        vswitchId: defaultVswitch.id,
        dbClusterNodesConfigs: Object.entries(dbClusterNodesConfigs).reduce((__obj, [node, config]) => ({ ...__obj, [node]: JSON.stringify(Object.entries(config).filter(([k, v]) => v != null).reduce((__obj, [k, v]) => ({ ...__obj, [k]: v }))) })),
    });
    const defaultZonalAccount = new alicloud.polardb.ZonalAccount("default", {
        dbClusterId: defaultZonalDbCluster.id,
        accountName: "terraform_example",
        accountPassword: "Example1234",
    });
    
    import pulumi
    import json
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    # The advanced configuration for all nodes in the cluster except for the RW node, including db_node_class, hot_replica_mode, and imci_switch properties.
    db_cluster_nodes_configs = config.get_object("dbClusterNodesConfigs")
    if db_cluster_nodes_configs is None:
        db_cluster_nodes_configs = {
            "db_node_1": {
                "dbNodeClass": "polar.mysql.x4.medium.c",
                "dbNodeRole": "Writer",
                "hotReplicaMode": None,
                "imciSwitch": None,
            },
        }
    default = alicloud.ens.Network("default",
        network_name="terraform-example",
        description="LoadBalancerNetworkDescription_test",
        cidr_block="192.168.2.0/24",
        ens_region_id="tr-Istanbul-1")
    default_vswitch = alicloud.ens.Vswitch("default",
        description="LoadBalancerVSwitchDescription_test",
        cidr_block="192.168.2.0/24",
        vswitch_name="terraform-example",
        ens_region_id="tr-Istanbul-1",
        network_id=default.id)
    default_zonal_db_cluster = alicloud.polardb.ZonalDbCluster("default",
        db_node_class="polar.mysql.x4.medium.c",
        description="terraform-example",
        ens_region_id="tr-Istanbul-1",
        vpc_id=default.id,
        vswitch_id=default_vswitch.id,
        db_cluster_nodes_configs={node: json.dumps({k: v for k, v in config if v != None}) for node, config in db_cluster_nodes_configs})
    default_zonal_account = alicloud.polardb.ZonalAccount("default",
        db_cluster_id=default_zonal_db_cluster.id,
        account_name="terraform_example",
        account_password="Example1234")
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        // The advanced configuration for all nodes in the cluster except for the RW node, including db_node_class, hot_replica_mode, and imci_switch properties.
        var dbClusterNodesConfigs = config.GetObject<Dictionary<string, DbClusterNodesConfigs>>("dbClusterNodesConfigs") ?? 
        {
            { "db_node_1", 
            {
                { "dbNodeClass", "polar.mysql.x4.medium.c" },
                { "dbNodeRole", "Writer" },
                { "hotReplicaMode", null },
                { "imciSwitch", null },
            } },
        };
        var @default = new AliCloud.Ens.Network("default", new()
        {
            NetworkName = "terraform-example",
            Description = "LoadBalancerNetworkDescription_test",
            CidrBlock = "192.168.2.0/24",
            EnsRegionId = "tr-Istanbul-1",
        });
    
        var defaultVswitch = new AliCloud.Ens.Vswitch("default", new()
        {
            Description = "LoadBalancerVSwitchDescription_test",
            CidrBlock = "192.168.2.0/24",
            VswitchName = "terraform-example",
            EnsRegionId = "tr-Istanbul-1",
            NetworkId = @default.Id,
        });
    
        var defaultZonalDbCluster = new AliCloud.PolarDB.ZonalDbCluster("default", new()
        {
            DbNodeClass = "polar.mysql.x4.medium.c",
            Description = "terraform-example",
            EnsRegionId = "tr-Istanbul-1",
            VpcId = @default.Id,
            VswitchId = defaultVswitch.Id,
            DbClusterNodesConfigs = dbClusterNodesConfigs.Select(pair => new { pair.Key, pair.Value }).ToDictionary(item => {
                var node = item.Key;
                return node;
            }, item => {
                var config = item.Value;
                return JsonSerializer.Serialize(.ToDictionary(item => {
                    var k = item.Key;
                    return k;
                }, item => {
                    var v = item.Value;
                    return v;
                }));
            }),
        });
    
        var defaultZonalAccount = new AliCloud.PolarDB.ZonalAccount("default", new()
        {
            DbClusterId = defaultZonalDbCluster.Id,
            AccountName = "terraform_example",
            AccountPassword = "Example1234",
        });
    
    });
    
    public class DbClusterNodesConfigs
    {
        public string dbNodeClass { get; set; }
        public string dbNodeRole { get; set; }
        public string hotReplicaMode { get; set; }
        public string imciSwitch { get; set; }
    }
    
    Example coming soon!
    
    Example coming soon!
    

    Create ZonalAccount Resource

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

    Constructor syntax

    new ZonalAccount(name: string, args: ZonalAccountArgs, opts?: CustomResourceOptions);
    @overload
    def ZonalAccount(resource_name: str,
                     args: ZonalAccountArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def ZonalAccount(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     account_name: Optional[str] = None,
                     db_cluster_id: Optional[str] = None,
                     account_description: Optional[str] = None,
                     account_password: Optional[str] = None,
                     account_type: Optional[str] = None)
    func NewZonalAccount(ctx *Context, name string, args ZonalAccountArgs, opts ...ResourceOption) (*ZonalAccount, error)
    public ZonalAccount(string name, ZonalAccountArgs args, CustomResourceOptions? opts = null)
    public ZonalAccount(String name, ZonalAccountArgs args)
    public ZonalAccount(String name, ZonalAccountArgs args, CustomResourceOptions options)
    
    type: alicloud:polardb:ZonalAccount
    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 ZonalAccountArgs
    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 ZonalAccountArgs
    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 ZonalAccountArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ZonalAccountArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ZonalAccountArgs
    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 zonalAccountResource = new AliCloud.PolarDB.ZonalAccount("zonalAccountResource", new()
    {
        AccountName = "string",
        DbClusterId = "string",
        AccountDescription = "string",
        AccountPassword = "string",
        AccountType = "string",
    });
    
    example, err := polardb.NewZonalAccount(ctx, "zonalAccountResource", &polardb.ZonalAccountArgs{
    	AccountName:        pulumi.String("string"),
    	DbClusterId:        pulumi.String("string"),
    	AccountDescription: pulumi.String("string"),
    	AccountPassword:    pulumi.String("string"),
    	AccountType:        pulumi.String("string"),
    })
    
    var zonalAccountResource = new ZonalAccount("zonalAccountResource", ZonalAccountArgs.builder()
        .accountName("string")
        .dbClusterId("string")
        .accountDescription("string")
        .accountPassword("string")
        .accountType("string")
        .build());
    
    zonal_account_resource = alicloud.polardb.ZonalAccount("zonalAccountResource",
        account_name="string",
        db_cluster_id="string",
        account_description="string",
        account_password="string",
        account_type="string")
    
    const zonalAccountResource = new alicloud.polardb.ZonalAccount("zonalAccountResource", {
        accountName: "string",
        dbClusterId: "string",
        accountDescription: "string",
        accountPassword: "string",
        accountType: "string",
    });
    
    type: alicloud:polardb:ZonalAccount
    properties:
        accountDescription: string
        accountName: string
        accountPassword: string
        accountType: string
        dbClusterId: string
    

    ZonalAccount Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ZonalAccount resource accepts the following input properties:

    AccountName string
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    DbClusterId string
    The Id of cluster in which account belongs.
    AccountDescription string
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    AccountPassword string
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    AccountType string
    Account type, Valid values are Normal, Super, Default to Normal.
    AccountName string
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    DbClusterId string
    The Id of cluster in which account belongs.
    AccountDescription string
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    AccountPassword string
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    AccountType string
    Account type, Valid values are Normal, Super, Default to Normal.
    accountName String
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    dbClusterId String
    The Id of cluster in which account belongs.
    accountDescription String
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    accountPassword String
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    accountType String
    Account type, Valid values are Normal, Super, Default to Normal.
    accountName string
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    dbClusterId string
    The Id of cluster in which account belongs.
    accountDescription string
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    accountPassword string
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    accountType string
    Account type, Valid values are Normal, Super, Default to Normal.
    account_name str
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    db_cluster_id str
    The Id of cluster in which account belongs.
    account_description str
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    account_password str
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    account_type str
    Account type, Valid values are Normal, Super, Default to Normal.
    accountName String
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    dbClusterId String
    The Id of cluster in which account belongs.
    accountDescription String
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    accountPassword String
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    accountType String
    Account type, Valid values are Normal, Super, Default to Normal.

    Outputs

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

    Get an existing ZonalAccount 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?: ZonalAccountState, opts?: CustomResourceOptions): ZonalAccount
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_description: Optional[str] = None,
            account_name: Optional[str] = None,
            account_password: Optional[str] = None,
            account_type: Optional[str] = None,
            db_cluster_id: Optional[str] = None) -> ZonalAccount
    func GetZonalAccount(ctx *Context, name string, id IDInput, state *ZonalAccountState, opts ...ResourceOption) (*ZonalAccount, error)
    public static ZonalAccount Get(string name, Input<string> id, ZonalAccountState? state, CustomResourceOptions? opts = null)
    public static ZonalAccount get(String name, Output<String> id, ZonalAccountState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:polardb:ZonalAccount    get:      id: ${id}
    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:
    AccountDescription string
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    AccountName string
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    AccountPassword string
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    AccountType string
    Account type, Valid values are Normal, Super, Default to Normal.
    DbClusterId string
    The Id of cluster in which account belongs.
    AccountDescription string
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    AccountName string
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    AccountPassword string
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    AccountType string
    Account type, Valid values are Normal, Super, Default to Normal.
    DbClusterId string
    The Id of cluster in which account belongs.
    accountDescription String
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    accountName String
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    accountPassword String
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    accountType String
    Account type, Valid values are Normal, Super, Default to Normal.
    dbClusterId String
    The Id of cluster in which account belongs.
    accountDescription string
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    accountName string
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    accountPassword string
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    accountType string
    Account type, Valid values are Normal, Super, Default to Normal.
    dbClusterId string
    The Id of cluster in which account belongs.
    account_description str
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    account_name str
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    account_password str
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    account_type str
    Account type, Valid values are Normal, Super, Default to Normal.
    db_cluster_id str
    The Id of cluster in which account belongs.
    accountDescription String
    Account description. It cannot begin with https://. It must start with a Chinese character or English letter. It can include Chinese and English characters, underlines (_), hyphens (-), and numbers. The length may be 2-256 characters.
    accountName String
    Operation account requiring a uniqueness check. It may consist of lower case letters, numbers, and underlines, and must start with a letter and have no more than 16 characters.
    accountPassword String
    Operation password. It may consist of letters, digits, or underlines, with a length of 6 to 32 characters.
    accountType String
    Account type, Valid values are Normal, Super, Default to Normal.
    dbClusterId String
    The Id of cluster in which account belongs.

    Import

    PolarDB Zonal account can be imported using the id, e.g.

    $ pulumi import alicloud:polardb/zonalAccount:ZonalAccount example "pc-12345:tf_account"
    

    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.88.0 published on Saturday, Nov 1, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate