Alibaba Cloud v3.87.0 published on Saturday, Oct 18, 2025 by Pulumi
alicloud.clickhouse.getAccounts
This data source provides the Click House Accounts of the current Alibaba Cloud user.
NOTE: Available since v1.134.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") || "oneaccountname";
const pwd = config.get("pwd") || "Tf-onepwd";
const type = config.get("type") || "Normal";
const _default = alicloud.clickhouse.getRegions({
current: true,
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "10.4.0.0/16",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vswitchName: name,
cidrBlock: "10.4.0.0/24",
vpcId: defaultNetwork.id,
zoneId: _default.then(_default => _default.regions?.[0]?.zoneIds?.[0]?.zoneId),
});
const defaultDbCluster = new alicloud.clickhouse.DbCluster("default", {
dbClusterVersion: "22.8.5.29",
category: "Basic",
dbClusterClass: "S8",
dbClusterNetworkType: "vpc",
dbClusterDescription: name,
dbNodeGroupCount: 1,
paymentType: "PayAsYouGo",
dbNodeStorage: "500",
storageType: "cloud_essd",
vswitchId: defaultSwitch.id,
vpcId: defaultNetwork.id,
});
const defaultAccount = new alicloud.clickhouse.Account("default", {
dbClusterId: defaultDbCluster.id,
accountDescription: "your_description",
accountName: name,
accountPassword: pwd,
type: type,
});
const defaultGetAccounts = alicloud.clickhouse.getAccountsOutput({
ids: [defaultAccount.id],
dbClusterId: defaultDbCluster.id,
});
export const accountId = defaultGetAccounts.apply(defaultGetAccounts => defaultGetAccounts.ids?.[0]);
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "oneaccountname"
pwd = config.get("pwd")
if pwd is None:
pwd = "Tf-onepwd"
type = config.get("type")
if type is None:
type = "Normal"
default = alicloud.clickhouse.get_regions(current=True)
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="10.4.0.0/16")
default_switch = alicloud.vpc.Switch("default",
vswitch_name=name,
cidr_block="10.4.0.0/24",
vpc_id=default_network.id,
zone_id=default.regions[0].zone_ids[0].zone_id)
default_db_cluster = alicloud.clickhouse.DbCluster("default",
db_cluster_version="22.8.5.29",
category="Basic",
db_cluster_class="S8",
db_cluster_network_type="vpc",
db_cluster_description=name,
db_node_group_count=1,
payment_type="PayAsYouGo",
db_node_storage="500",
storage_type="cloud_essd",
vswitch_id=default_switch.id,
vpc_id=default_network.id)
default_account = alicloud.clickhouse.Account("default",
db_cluster_id=default_db_cluster.id,
account_description="your_description",
account_name=name,
account_password=pwd,
type=type)
default_get_accounts = alicloud.clickhouse.get_accounts_output(ids=[default_account.id],
db_cluster_id=default_db_cluster.id)
pulumi.export("accountId", default_get_accounts.ids[0])
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/clickhouse"
"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 := "oneaccountname"
if param := cfg.Get("name"); param != "" {
name = param
}
pwd := "Tf-onepwd"
if param := cfg.Get("pwd"); param != "" {
pwd = param
}
_type := "Normal"
if param := cfg.Get("type"); param != "" {
_type = param
}
_default, err := clickhouse.GetRegions(ctx, &clickhouse.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/16"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/24"),
VpcId: defaultNetwork.ID(),
ZoneId: pulumi.String(_default.Regions[0].ZoneIds[0].ZoneId),
})
if err != nil {
return err
}
defaultDbCluster, err := clickhouse.NewDbCluster(ctx, "default", &clickhouse.DbClusterArgs{
DbClusterVersion: pulumi.String("22.8.5.29"),
Category: pulumi.String("Basic"),
DbClusterClass: pulumi.String("S8"),
DbClusterNetworkType: pulumi.String("vpc"),
DbClusterDescription: pulumi.String(name),
DbNodeGroupCount: pulumi.Int(1),
PaymentType: pulumi.String("PayAsYouGo"),
DbNodeStorage: pulumi.String("500"),
StorageType: pulumi.String("cloud_essd"),
VswitchId: defaultSwitch.ID(),
VpcId: defaultNetwork.ID(),
})
if err != nil {
return err
}
defaultAccount, err := clickhouse.NewAccount(ctx, "default", &clickhouse.AccountArgs{
DbClusterId: defaultDbCluster.ID(),
AccountDescription: pulumi.String("your_description"),
AccountName: pulumi.String(name),
AccountPassword: pulumi.String(pwd),
Type: pulumi.String(_type),
})
if err != nil {
return err
}
defaultGetAccounts := clickhouse.GetAccountsOutput(ctx, clickhouse.GetAccountsOutputArgs{
Ids: pulumi.StringArray{
defaultAccount.ID(),
},
DbClusterId: defaultDbCluster.ID(),
}, nil)
ctx.Export("accountId", defaultGetAccounts.ApplyT(func(defaultGetAccounts clickhouse.GetAccountsResult) (*string, error) {
return &defaultGetAccounts.Ids[0], nil
}).(pulumi.StringPtrOutput))
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") ?? "oneaccountname";
var pwd = config.Get("pwd") ?? "Tf-onepwd";
var type = config.Get("type") ?? "Normal";
var @default = AliCloud.ClickHouse.GetRegions.Invoke(new()
{
Current = true,
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "10.4.0.0/16",
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VswitchName = name,
CidrBlock = "10.4.0.0/24",
VpcId = defaultNetwork.Id,
ZoneId = @default.Apply(@default => @default.Apply(getRegionsResult => getRegionsResult.Regions[0]?.ZoneIds[0]?.ZoneId)),
});
var defaultDbCluster = new AliCloud.ClickHouse.DbCluster("default", new()
{
DbClusterVersion = "22.8.5.29",
Category = "Basic",
DbClusterClass = "S8",
DbClusterNetworkType = "vpc",
DbClusterDescription = name,
DbNodeGroupCount = 1,
PaymentType = "PayAsYouGo",
DbNodeStorage = "500",
StorageType = "cloud_essd",
VswitchId = defaultSwitch.Id,
VpcId = defaultNetwork.Id,
});
var defaultAccount = new AliCloud.ClickHouse.Account("default", new()
{
DbClusterId = defaultDbCluster.Id,
AccountDescription = "your_description",
AccountName = name,
AccountPassword = pwd,
Type = type,
});
var defaultGetAccounts = AliCloud.ClickHouse.GetAccounts.Invoke(new()
{
Ids = new[]
{
defaultAccount.Id,
},
DbClusterId = defaultDbCluster.Id,
});
return new Dictionary<string, object?>
{
["accountId"] = defaultGetAccounts.Apply(getAccountsResult => getAccountsResult.Ids[0]),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.clickhouse.ClickhouseFunctions;
import com.pulumi.alicloud.clickhouse.inputs.GetRegionsArgs;
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.clickhouse.DbCluster;
import com.pulumi.alicloud.clickhouse.DbClusterArgs;
import com.pulumi.alicloud.clickhouse.Account;
import com.pulumi.alicloud.clickhouse.AccountArgs;
import com.pulumi.alicloud.clickhouse.inputs.GetAccountsArgs;
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("oneaccountname");
final var pwd = config.get("pwd").orElse("Tf-onepwd");
final var type = config.get("type").orElse("Normal");
final var default = ClickhouseFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/24")
.vpcId(defaultNetwork.id())
.zoneId(default_.regions()[0].zoneIds()[0].zoneId())
.build());
var defaultDbCluster = new DbCluster("defaultDbCluster", DbClusterArgs.builder()
.dbClusterVersion("22.8.5.29")
.category("Basic")
.dbClusterClass("S8")
.dbClusterNetworkType("vpc")
.dbClusterDescription(name)
.dbNodeGroupCount(1)
.paymentType("PayAsYouGo")
.dbNodeStorage("500")
.storageType("cloud_essd")
.vswitchId(defaultSwitch.id())
.vpcId(defaultNetwork.id())
.build());
var defaultAccount = new Account("defaultAccount", AccountArgs.builder()
.dbClusterId(defaultDbCluster.id())
.accountDescription("your_description")
.accountName(name)
.accountPassword(pwd)
.type(type)
.build());
final var defaultGetAccounts = ClickhouseFunctions.getAccounts(GetAccountsArgs.builder()
.ids(defaultAccount.id())
.dbClusterId(defaultDbCluster.id())
.build());
ctx.export("accountId", defaultGetAccounts.applyValue(_defaultGetAccounts -> _defaultGetAccounts.ids()[0]));
}
}
configuration:
name:
type: string
default: oneaccountname
pwd:
type: string
default: Tf-onepwd
type:
type: string
default: Normal
resources:
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: ${name}
cidrBlock: 10.4.0.0/16
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vswitchName: ${name}
cidrBlock: 10.4.0.0/24
vpcId: ${defaultNetwork.id}
zoneId: ${default.regions[0].zoneIds[0].zoneId}
defaultDbCluster:
type: alicloud:clickhouse:DbCluster
name: default
properties:
dbClusterVersion: 22.8.5.29
category: Basic
dbClusterClass: S8
dbClusterNetworkType: vpc
dbClusterDescription: ${name}
dbNodeGroupCount: '1'
paymentType: PayAsYouGo
dbNodeStorage: '500'
storageType: cloud_essd
vswitchId: ${defaultSwitch.id}
vpcId: ${defaultNetwork.id}
defaultAccount:
type: alicloud:clickhouse:Account
name: default
properties:
dbClusterId: ${defaultDbCluster.id}
accountDescription: your_description
accountName: ${name}
accountPassword: ${pwd}
type: ${type}
variables:
default:
fn::invoke:
function: alicloud:clickhouse:getRegions
arguments:
current: true
defaultGetAccounts:
fn::invoke:
function: alicloud:clickhouse:getAccounts
arguments:
ids:
- ${defaultAccount.id}
dbClusterId: ${defaultDbCluster.id}
outputs:
accountId: ${defaultGetAccounts.ids[0]}
Using getAccounts
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getAccounts(args: GetAccountsArgs, opts?: InvokeOptions): Promise<GetAccountsResult>
function getAccountsOutput(args: GetAccountsOutputArgs, opts?: InvokeOptions): Output<GetAccountsResult>
def get_accounts(db_cluster_id: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
status: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAccountsResult
def get_accounts_output(db_cluster_id: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAccountsResult]
func GetAccounts(ctx *Context, args *GetAccountsArgs, opts ...InvokeOption) (*GetAccountsResult, error)
func GetAccountsOutput(ctx *Context, args *GetAccountsOutputArgs, opts ...InvokeOption) GetAccountsResultOutput
> Note: This function is named GetAccounts
in the Go SDK.
public static class GetAccounts
{
public static Task<GetAccountsResult> InvokeAsync(GetAccountsArgs args, InvokeOptions? opts = null)
public static Output<GetAccountsResult> Invoke(GetAccountsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAccountsResult> getAccounts(GetAccountsArgs args, InvokeOptions options)
public static Output<GetAccountsResult> getAccounts(GetAccountsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:clickhouse/getAccounts:getAccounts
arguments:
# arguments dictionary
The following arguments are supported:
- Db
Cluster stringId - The DBCluster id.
- Ids List<string>
- A list of Account IDs. Its element value is same as Account Name.
- Name
Regex string - A regex string to filter results by Account name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Status string
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- Db
Cluster stringId - The DBCluster id.
- Ids []string
- A list of Account IDs. Its element value is same as Account Name.
- Name
Regex string - A regex string to filter results by Account name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Status string
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- db
Cluster StringId - The DBCluster id.
- ids List<String>
- A list of Account IDs. Its element value is same as Account Name.
- name
Regex String - A regex string to filter results by Account name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - status String
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- db
Cluster stringId - The DBCluster id.
- ids string[]
- A list of Account IDs. Its element value is same as Account Name.
- name
Regex string - A regex string to filter results by Account name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - status string
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- db_
cluster_ strid - The DBCluster id.
- ids Sequence[str]
- A list of Account IDs. Its element value is same as Account Name.
- name_
regex str - A regex string to filter results by Account name.
- output_
file str - File name where to save data source results (after running
pulumi preview
). - status str
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- db
Cluster StringId - The DBCluster id.
- ids List<String>
- A list of Account IDs. Its element value is same as Account Name.
- name
Regex String - A regex string to filter results by Account name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - status String
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
getAccounts Result
The following output properties are available:
- Accounts
List<Pulumi.
Ali Cloud. Click House. Outputs. Get Accounts Account> - A list of Click House Accounts. Each element contains the following attributes:
- Db
Cluster stringId - The DBCluster id.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- A list of Account names.
- Name
Regex string - Output
File string - Status string
- The status of the resource.
- Accounts
[]Get
Accounts Account - A list of Click House Accounts. Each element contains the following attributes:
- Db
Cluster stringId - The DBCluster id.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- A list of Account names.
- Name
Regex string - Output
File string - Status string
- The status of the resource.
- accounts
List<Get
Accounts Account> - A list of Click House Accounts. Each element contains the following attributes:
- db
Cluster StringId - The DBCluster id.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of Account names.
- name
Regex String - output
File String - status String
- The status of the resource.
- accounts
Get
Accounts Account[] - A list of Click House Accounts. Each element contains the following attributes:
- db
Cluster stringId - The DBCluster id.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- A list of Account names.
- name
Regex string - output
File string - status string
- The status of the resource.
- accounts
Sequence[Get
Accounts Account] - A list of Click House Accounts. Each element contains the following attributes:
- db_
cluster_ strid - The DBCluster id.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- A list of Account names.
- name_
regex str - output_
file str - status str
- The status of the resource.
- accounts List<Property Map>
- A list of Click House Accounts. Each element contains the following attributes:
- db
Cluster StringId - The DBCluster id.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of Account names.
- name
Regex String - output
File String - status String
- The status of the resource.
Supporting Types
GetAccountsAccount
- Account
Description string - In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- Account
Name string - Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- Account
Type string - The Valid Account type:
Normal
,Super
. - Db
Cluster stringId - The DBCluster id.
- Id string
- The ID of the Account. Its value is same as Queue Name.
- Status string
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- Account
Description string - In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- Account
Name string - Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- Account
Type string - The Valid Account type:
Normal
,Super
. - Db
Cluster stringId - The DBCluster id.
- Id string
- The ID of the Account. Its value is same as Queue Name.
- Status string
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- account
Description String - In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account
Name String - Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account
Type String - The Valid Account type:
Normal
,Super
. - db
Cluster StringId - The DBCluster id.
- id String
- The ID of the Account. Its value is same as Queue Name.
- status String
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- account
Description string - In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account
Name string - Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account
Type string - The Valid Account type:
Normal
,Super
. - db
Cluster stringId - The DBCluster id.
- id string
- The ID of the Account. Its value is same as Queue Name.
- status string
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- account_
description str - In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account_
name str - Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account_
type str - The Valid Account type:
Normal
,Super
. - db_
cluster_ strid - The DBCluster id.
- id str
- The ID of the Account. Its value is same as Queue Name.
- status str
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
- account
Description String - In Chinese, English letter. May contain Chinese and English characters, lowercase letters, numbers, and underscores (_), the dash (-). Cannot start with http:// and https:// at the beginning. Length is from 2 to 256 characters.
- account
Name String - Account name: lowercase letters, numbers, underscores, lowercase letter; length no more than 16 characters.
- account
Type String - The Valid Account type:
Normal
,Super
. - db
Cluster StringId - The DBCluster id.
- id String
- The ID of the Account. Its value is same as Queue Name.
- status String
- The status of the resource. Valid Status:
Creating
,Available
,Deleting
.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.