1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. ClickhouseAccountPermission
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.ClickhouseAccountPermission

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a clickhouse account_permission

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const accountPermissionAllDatabase = new tencentcloud.ClickhouseAccountPermission("accountPermissionAllDatabase", {
        allDatabase: true,
        cluster: "default_cluster",
        globalPrivileges: [
            "SELECT",
            "ALTER",
        ],
        instanceId: "cdwch-xxxxxx",
        userName: "user1",
    });
    const accountPermissionNotAllDatabase = new tencentcloud.ClickhouseAccountPermission("accountPermissionNotAllDatabase", {
        allDatabase: false,
        cluster: "default_cluster",
        databasePrivilegeLists: [{
            databaseName: "xxxxxx",
            databasePrivileges: [
                "SELECT",
                "ALTER",
            ],
        }],
        instanceId: "cdwch-xxxxxx",
        userName: "user2",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    account_permission_all_database = tencentcloud.ClickhouseAccountPermission("accountPermissionAllDatabase",
        all_database=True,
        cluster="default_cluster",
        global_privileges=[
            "SELECT",
            "ALTER",
        ],
        instance_id="cdwch-xxxxxx",
        user_name="user1")
    account_permission_not_all_database = tencentcloud.ClickhouseAccountPermission("accountPermissionNotAllDatabase",
        all_database=False,
        cluster="default_cluster",
        database_privilege_lists=[{
            "database_name": "xxxxxx",
            "database_privileges": [
                "SELECT",
                "ALTER",
            ],
        }],
        instance_id="cdwch-xxxxxx",
        user_name="user2")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.NewClickhouseAccountPermission(ctx, "accountPermissionAllDatabase", &tencentcloud.ClickhouseAccountPermissionArgs{
    			AllDatabase: pulumi.Bool(true),
    			Cluster:     pulumi.String("default_cluster"),
    			GlobalPrivileges: pulumi.StringArray{
    				pulumi.String("SELECT"),
    				pulumi.String("ALTER"),
    			},
    			InstanceId: pulumi.String("cdwch-xxxxxx"),
    			UserName:   pulumi.String("user1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewClickhouseAccountPermission(ctx, "accountPermissionNotAllDatabase", &tencentcloud.ClickhouseAccountPermissionArgs{
    			AllDatabase: pulumi.Bool(false),
    			Cluster:     pulumi.String("default_cluster"),
    			DatabasePrivilegeLists: tencentcloud.ClickhouseAccountPermissionDatabasePrivilegeListArray{
    				&tencentcloud.ClickhouseAccountPermissionDatabasePrivilegeListArgs{
    					DatabaseName: pulumi.String("xxxxxx"),
    					DatabasePrivileges: pulumi.StringArray{
    						pulumi.String("SELECT"),
    						pulumi.String("ALTER"),
    					},
    				},
    			},
    			InstanceId: pulumi.String("cdwch-xxxxxx"),
    			UserName:   pulumi.String("user2"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var accountPermissionAllDatabase = new Tencentcloud.ClickhouseAccountPermission("accountPermissionAllDatabase", new()
        {
            AllDatabase = true,
            Cluster = "default_cluster",
            GlobalPrivileges = new[]
            {
                "SELECT",
                "ALTER",
            },
            InstanceId = "cdwch-xxxxxx",
            UserName = "user1",
        });
    
        var accountPermissionNotAllDatabase = new Tencentcloud.ClickhouseAccountPermission("accountPermissionNotAllDatabase", new()
        {
            AllDatabase = false,
            Cluster = "default_cluster",
            DatabasePrivilegeLists = new[]
            {
                new Tencentcloud.Inputs.ClickhouseAccountPermissionDatabasePrivilegeListArgs
                {
                    DatabaseName = "xxxxxx",
                    DatabasePrivileges = new[]
                    {
                        "SELECT",
                        "ALTER",
                    },
                },
            },
            InstanceId = "cdwch-xxxxxx",
            UserName = "user2",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.ClickhouseAccountPermission;
    import com.pulumi.tencentcloud.ClickhouseAccountPermissionArgs;
    import com.pulumi.tencentcloud.inputs.ClickhouseAccountPermissionDatabasePrivilegeListArgs;
    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) {
            var accountPermissionAllDatabase = new ClickhouseAccountPermission("accountPermissionAllDatabase", ClickhouseAccountPermissionArgs.builder()
                .allDatabase(true)
                .cluster("default_cluster")
                .globalPrivileges(            
                    "SELECT",
                    "ALTER")
                .instanceId("cdwch-xxxxxx")
                .userName("user1")
                .build());
    
            var accountPermissionNotAllDatabase = new ClickhouseAccountPermission("accountPermissionNotAllDatabase", ClickhouseAccountPermissionArgs.builder()
                .allDatabase(false)
                .cluster("default_cluster")
                .databasePrivilegeLists(ClickhouseAccountPermissionDatabasePrivilegeListArgs.builder()
                    .databaseName("xxxxxx")
                    .databasePrivileges(                
                        "SELECT",
                        "ALTER")
                    .build())
                .instanceId("cdwch-xxxxxx")
                .userName("user2")
                .build());
    
        }
    }
    
    resources:
      accountPermissionAllDatabase:
        type: tencentcloud:ClickhouseAccountPermission
        properties:
          allDatabase: true
          cluster: default_cluster
          globalPrivileges:
            - SELECT
            - ALTER
          instanceId: cdwch-xxxxxx
          userName: user1
      accountPermissionNotAllDatabase:
        type: tencentcloud:ClickhouseAccountPermission
        properties:
          allDatabase: false
          cluster: default_cluster
          databasePrivilegeLists:
            - databaseName: xxxxxx
              databasePrivileges:
                - SELECT
                - ALTER
          instanceId: cdwch-xxxxxx
          userName: user2
    

    Create ClickhouseAccountPermission Resource

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

    Constructor syntax

    new ClickhouseAccountPermission(name: string, args: ClickhouseAccountPermissionArgs, opts?: CustomResourceOptions);
    @overload
    def ClickhouseAccountPermission(resource_name: str,
                                    args: ClickhouseAccountPermissionArgs,
                                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def ClickhouseAccountPermission(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    all_database: Optional[bool] = None,
                                    cluster: Optional[str] = None,
                                    instance_id: Optional[str] = None,
                                    user_name: Optional[str] = None,
                                    clickhouse_account_permission_id: Optional[str] = None,
                                    database_privilege_lists: Optional[Sequence[ClickhouseAccountPermissionDatabasePrivilegeListArgs]] = None,
                                    global_privileges: Optional[Sequence[str]] = None)
    func NewClickhouseAccountPermission(ctx *Context, name string, args ClickhouseAccountPermissionArgs, opts ...ResourceOption) (*ClickhouseAccountPermission, error)
    public ClickhouseAccountPermission(string name, ClickhouseAccountPermissionArgs args, CustomResourceOptions? opts = null)
    public ClickhouseAccountPermission(String name, ClickhouseAccountPermissionArgs args)
    public ClickhouseAccountPermission(String name, ClickhouseAccountPermissionArgs args, CustomResourceOptions options)
    
    type: tencentcloud:ClickhouseAccountPermission
    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 ClickhouseAccountPermissionArgs
    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 ClickhouseAccountPermissionArgs
    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 ClickhouseAccountPermissionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ClickhouseAccountPermissionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ClickhouseAccountPermissionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    AllDatabase bool
    Whether all database tables.
    Cluster string
    Cluster name.
    InstanceId string
    Instance id.
    UserName string
    User name.
    ClickhouseAccountPermissionId string
    ID of the resource.
    DatabasePrivilegeLists List<ClickhouseAccountPermissionDatabasePrivilegeList>
    Database privilege list.
    GlobalPrivileges List<string>
    Global privileges.
    AllDatabase bool
    Whether all database tables.
    Cluster string
    Cluster name.
    InstanceId string
    Instance id.
    UserName string
    User name.
    ClickhouseAccountPermissionId string
    ID of the resource.
    DatabasePrivilegeLists []ClickhouseAccountPermissionDatabasePrivilegeListArgs
    Database privilege list.
    GlobalPrivileges []string
    Global privileges.
    allDatabase Boolean
    Whether all database tables.
    cluster String
    Cluster name.
    instanceId String
    Instance id.
    userName String
    User name.
    clickhouseAccountPermissionId String
    ID of the resource.
    databasePrivilegeLists List<ClickhouseAccountPermissionDatabasePrivilegeList>
    Database privilege list.
    globalPrivileges List<String>
    Global privileges.
    allDatabase boolean
    Whether all database tables.
    cluster string
    Cluster name.
    instanceId string
    Instance id.
    userName string
    User name.
    clickhouseAccountPermissionId string
    ID of the resource.
    databasePrivilegeLists ClickhouseAccountPermissionDatabasePrivilegeList[]
    Database privilege list.
    globalPrivileges string[]
    Global privileges.
    all_database bool
    Whether all database tables.
    cluster str
    Cluster name.
    instance_id str
    Instance id.
    user_name str
    User name.
    clickhouse_account_permission_id str
    ID of the resource.
    database_privilege_lists Sequence[ClickhouseAccountPermissionDatabasePrivilegeListArgs]
    Database privilege list.
    global_privileges Sequence[str]
    Global privileges.
    allDatabase Boolean
    Whether all database tables.
    cluster String
    Cluster name.
    instanceId String
    Instance id.
    userName String
    User name.
    clickhouseAccountPermissionId String
    ID of the resource.
    databasePrivilegeLists List<Property Map>
    Database privilege list.
    globalPrivileges List<String>
    Global privileges.

    Outputs

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

    Get an existing ClickhouseAccountPermission 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?: ClickhouseAccountPermissionState, opts?: CustomResourceOptions): ClickhouseAccountPermission
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            all_database: Optional[bool] = None,
            clickhouse_account_permission_id: Optional[str] = None,
            cluster: Optional[str] = None,
            database_privilege_lists: Optional[Sequence[ClickhouseAccountPermissionDatabasePrivilegeListArgs]] = None,
            global_privileges: Optional[Sequence[str]] = None,
            instance_id: Optional[str] = None,
            user_name: Optional[str] = None) -> ClickhouseAccountPermission
    func GetClickhouseAccountPermission(ctx *Context, name string, id IDInput, state *ClickhouseAccountPermissionState, opts ...ResourceOption) (*ClickhouseAccountPermission, error)
    public static ClickhouseAccountPermission Get(string name, Input<string> id, ClickhouseAccountPermissionState? state, CustomResourceOptions? opts = null)
    public static ClickhouseAccountPermission get(String name, Output<String> id, ClickhouseAccountPermissionState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:ClickhouseAccountPermission    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:
    AllDatabase bool
    Whether all database tables.
    ClickhouseAccountPermissionId string
    ID of the resource.
    Cluster string
    Cluster name.
    DatabasePrivilegeLists List<ClickhouseAccountPermissionDatabasePrivilegeList>
    Database privilege list.
    GlobalPrivileges List<string>
    Global privileges.
    InstanceId string
    Instance id.
    UserName string
    User name.
    AllDatabase bool
    Whether all database tables.
    ClickhouseAccountPermissionId string
    ID of the resource.
    Cluster string
    Cluster name.
    DatabasePrivilegeLists []ClickhouseAccountPermissionDatabasePrivilegeListArgs
    Database privilege list.
    GlobalPrivileges []string
    Global privileges.
    InstanceId string
    Instance id.
    UserName string
    User name.
    allDatabase Boolean
    Whether all database tables.
    clickhouseAccountPermissionId String
    ID of the resource.
    cluster String
    Cluster name.
    databasePrivilegeLists List<ClickhouseAccountPermissionDatabasePrivilegeList>
    Database privilege list.
    globalPrivileges List<String>
    Global privileges.
    instanceId String
    Instance id.
    userName String
    User name.
    allDatabase boolean
    Whether all database tables.
    clickhouseAccountPermissionId string
    ID of the resource.
    cluster string
    Cluster name.
    databasePrivilegeLists ClickhouseAccountPermissionDatabasePrivilegeList[]
    Database privilege list.
    globalPrivileges string[]
    Global privileges.
    instanceId string
    Instance id.
    userName string
    User name.
    all_database bool
    Whether all database tables.
    clickhouse_account_permission_id str
    ID of the resource.
    cluster str
    Cluster name.
    database_privilege_lists Sequence[ClickhouseAccountPermissionDatabasePrivilegeListArgs]
    Database privilege list.
    global_privileges Sequence[str]
    Global privileges.
    instance_id str
    Instance id.
    user_name str
    User name.
    allDatabase Boolean
    Whether all database tables.
    clickhouseAccountPermissionId String
    ID of the resource.
    cluster String
    Cluster name.
    databasePrivilegeLists List<Property Map>
    Database privilege list.
    globalPrivileges List<String>
    Global privileges.
    instanceId String
    Instance id.
    userName String
    User name.

    Supporting Types

    ClickhouseAccountPermissionDatabasePrivilegeList, ClickhouseAccountPermissionDatabasePrivilegeListArgs

    DatabaseName string
    Database name.
    DatabasePrivileges List<string>
    Database privileges. Valid valuse: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE, CREATE_TABLE, DROP_DATABASE.
    TablePrivilegeLists List<ClickhouseAccountPermissionDatabasePrivilegeListTablePrivilegeList>
    Table privilege list.
    DatabaseName string
    Database name.
    DatabasePrivileges []string
    Database privileges. Valid valuse: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE, CREATE_TABLE, DROP_DATABASE.
    TablePrivilegeLists []ClickhouseAccountPermissionDatabasePrivilegeListTablePrivilegeList
    Table privilege list.
    databaseName String
    Database name.
    databasePrivileges List<String>
    Database privileges. Valid valuse: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE, CREATE_TABLE, DROP_DATABASE.
    tablePrivilegeLists List<ClickhouseAccountPermissionDatabasePrivilegeListTablePrivilegeList>
    Table privilege list.
    databaseName string
    Database name.
    databasePrivileges string[]
    Database privileges. Valid valuse: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE, CREATE_TABLE, DROP_DATABASE.
    tablePrivilegeLists ClickhouseAccountPermissionDatabasePrivilegeListTablePrivilegeList[]
    Table privilege list.
    database_name str
    Database name.
    database_privileges Sequence[str]
    Database privileges. Valid valuse: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE, CREATE_TABLE, DROP_DATABASE.
    table_privilege_lists Sequence[ClickhouseAccountPermissionDatabasePrivilegeListTablePrivilegeList]
    Table privilege list.
    databaseName String
    Database name.
    databasePrivileges List<String>
    Database privileges. Valid valuse: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE, CREATE_TABLE, DROP_DATABASE.
    tablePrivilegeLists List<Property Map>
    Table privilege list.

    ClickhouseAccountPermissionDatabasePrivilegeListTablePrivilegeList, ClickhouseAccountPermissionDatabasePrivilegeListTablePrivilegeListArgs

    TableName string
    Table name.
    TablePrivileges List<string>
    Table privileges. Valid values: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE.
    TableName string
    Table name.
    TablePrivileges []string
    Table privileges. Valid values: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE.
    tableName String
    Table name.
    tablePrivileges List<String>
    Table privileges. Valid values: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE.
    tableName string
    Table name.
    tablePrivileges string[]
    Table privileges. Valid values: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE.
    table_name str
    Table name.
    table_privileges Sequence[str]
    Table privileges. Valid values: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE.
    tableName String
    Table name.
    tablePrivileges List<String>
    Table privileges. Valid values: SELECT, INSERT_ALL, ALTER, TRUNCATE, DROP_TABLE.

    Import

    clickhouse account_permission can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/clickhouseAccountPermission:ClickhouseAccountPermission account_permission ${instanceId}#${cluster}#${userName}
    

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

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack