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

tencentcloud.CynosdbAccountPrivileges

Explore with Pulumi AI

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

    Provides a resource to create a cynosdb account_privileges

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const accountPrivileges = new tencentcloud.CynosdbAccountPrivileges("accountPrivileges", {
        accountName: "test",
        clusterId: "cynosdbmysql-bws8h88b",
        databasePrivileges: [{
            db: "users",
            privileges: [
                "DROP",
                "REFERENCES",
                "INDEX",
                "CREATE VIEW",
                "INSERT",
                "EVENT",
            ],
        }],
        globalPrivileges: [
            "CREATE",
            "DROP",
            "ALTER",
            "CREATE TEMPORARY TABLES",
            "CREATE VIEW",
        ],
        host: "%",
        tablePrivileges: [{
            db: "users",
            privileges: [
                "ALTER",
                "REFERENCES",
                "SHOW VIEW",
            ],
            tableName: "tb_user_name",
        }],
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    account_privileges = tencentcloud.CynosdbAccountPrivileges("accountPrivileges",
        account_name="test",
        cluster_id="cynosdbmysql-bws8h88b",
        database_privileges=[{
            "db": "users",
            "privileges": [
                "DROP",
                "REFERENCES",
                "INDEX",
                "CREATE VIEW",
                "INSERT",
                "EVENT",
            ],
        }],
        global_privileges=[
            "CREATE",
            "DROP",
            "ALTER",
            "CREATE TEMPORARY TABLES",
            "CREATE VIEW",
        ],
        host="%",
        table_privileges=[{
            "db": "users",
            "privileges": [
                "ALTER",
                "REFERENCES",
                "SHOW VIEW",
            ],
            "table_name": "tb_user_name",
        }])
    
    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.NewCynosdbAccountPrivileges(ctx, "accountPrivileges", &tencentcloud.CynosdbAccountPrivilegesArgs{
    			AccountName: pulumi.String("test"),
    			ClusterId:   pulumi.String("cynosdbmysql-bws8h88b"),
    			DatabasePrivileges: tencentcloud.CynosdbAccountPrivilegesDatabasePrivilegeArray{
    				&tencentcloud.CynosdbAccountPrivilegesDatabasePrivilegeArgs{
    					Db: pulumi.String("users"),
    					Privileges: pulumi.StringArray{
    						pulumi.String("DROP"),
    						pulumi.String("REFERENCES"),
    						pulumi.String("INDEX"),
    						pulumi.String("CREATE VIEW"),
    						pulumi.String("INSERT"),
    						pulumi.String("EVENT"),
    					},
    				},
    			},
    			GlobalPrivileges: pulumi.StringArray{
    				pulumi.String("CREATE"),
    				pulumi.String("DROP"),
    				pulumi.String("ALTER"),
    				pulumi.String("CREATE TEMPORARY TABLES"),
    				pulumi.String("CREATE VIEW"),
    			},
    			Host: pulumi.String("%"),
    			TablePrivileges: tencentcloud.CynosdbAccountPrivilegesTablePrivilegeArray{
    				&tencentcloud.CynosdbAccountPrivilegesTablePrivilegeArgs{
    					Db: pulumi.String("users"),
    					Privileges: pulumi.StringArray{
    						pulumi.String("ALTER"),
    						pulumi.String("REFERENCES"),
    						pulumi.String("SHOW VIEW"),
    					},
    					TableName: pulumi.String("tb_user_name"),
    				},
    			},
    		})
    		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 accountPrivileges = new Tencentcloud.CynosdbAccountPrivileges("accountPrivileges", new()
        {
            AccountName = "test",
            ClusterId = "cynosdbmysql-bws8h88b",
            DatabasePrivileges = new[]
            {
                new Tencentcloud.Inputs.CynosdbAccountPrivilegesDatabasePrivilegeArgs
                {
                    Db = "users",
                    Privileges = new[]
                    {
                        "DROP",
                        "REFERENCES",
                        "INDEX",
                        "CREATE VIEW",
                        "INSERT",
                        "EVENT",
                    },
                },
            },
            GlobalPrivileges = new[]
            {
                "CREATE",
                "DROP",
                "ALTER",
                "CREATE TEMPORARY TABLES",
                "CREATE VIEW",
            },
            Host = "%",
            TablePrivileges = new[]
            {
                new Tencentcloud.Inputs.CynosdbAccountPrivilegesTablePrivilegeArgs
                {
                    Db = "users",
                    Privileges = new[]
                    {
                        "ALTER",
                        "REFERENCES",
                        "SHOW VIEW",
                    },
                    TableName = "tb_user_name",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.CynosdbAccountPrivileges;
    import com.pulumi.tencentcloud.CynosdbAccountPrivilegesArgs;
    import com.pulumi.tencentcloud.inputs.CynosdbAccountPrivilegesDatabasePrivilegeArgs;
    import com.pulumi.tencentcloud.inputs.CynosdbAccountPrivilegesTablePrivilegeArgs;
    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 accountPrivileges = new CynosdbAccountPrivileges("accountPrivileges", CynosdbAccountPrivilegesArgs.builder()
                .accountName("test")
                .clusterId("cynosdbmysql-bws8h88b")
                .databasePrivileges(CynosdbAccountPrivilegesDatabasePrivilegeArgs.builder()
                    .db("users")
                    .privileges(                
                        "DROP",
                        "REFERENCES",
                        "INDEX",
                        "CREATE VIEW",
                        "INSERT",
                        "EVENT")
                    .build())
                .globalPrivileges(            
                    "CREATE",
                    "DROP",
                    "ALTER",
                    "CREATE TEMPORARY TABLES",
                    "CREATE VIEW")
                .host("%")
                .tablePrivileges(CynosdbAccountPrivilegesTablePrivilegeArgs.builder()
                    .db("users")
                    .privileges(                
                        "ALTER",
                        "REFERENCES",
                        "SHOW VIEW")
                    .tableName("tb_user_name")
                    .build())
                .build());
    
        }
    }
    
    resources:
      accountPrivileges:
        type: tencentcloud:CynosdbAccountPrivileges
        properties:
          accountName: test
          clusterId: cynosdbmysql-bws8h88b
          databasePrivileges:
            - db: users
              privileges:
                - DROP
                - REFERENCES
                - INDEX
                - CREATE VIEW
                - INSERT
                - EVENT
          globalPrivileges:
            - CREATE
            - DROP
            - ALTER
            - CREATE TEMPORARY TABLES
            - CREATE VIEW
          host: '%'
          tablePrivileges:
            - db: users
              privileges:
                - ALTER
                - REFERENCES
                - SHOW VIEW
              tableName: tb_user_name
    

    Create CynosdbAccountPrivileges Resource

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

    Constructor syntax

    new CynosdbAccountPrivileges(name: string, args: CynosdbAccountPrivilegesArgs, opts?: CustomResourceOptions);
    @overload
    def CynosdbAccountPrivileges(resource_name: str,
                                 args: CynosdbAccountPrivilegesArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def CynosdbAccountPrivileges(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 account_name: Optional[str] = None,
                                 cluster_id: Optional[str] = None,
                                 global_privileges: Optional[Sequence[str]] = None,
                                 cynosdb_account_privileges_id: Optional[str] = None,
                                 database_privileges: Optional[Sequence[CynosdbAccountPrivilegesDatabasePrivilegeArgs]] = None,
                                 host: Optional[str] = None,
                                 table_privileges: Optional[Sequence[CynosdbAccountPrivilegesTablePrivilegeArgs]] = None)
    func NewCynosdbAccountPrivileges(ctx *Context, name string, args CynosdbAccountPrivilegesArgs, opts ...ResourceOption) (*CynosdbAccountPrivileges, error)
    public CynosdbAccountPrivileges(string name, CynosdbAccountPrivilegesArgs args, CustomResourceOptions? opts = null)
    public CynosdbAccountPrivileges(String name, CynosdbAccountPrivilegesArgs args)
    public CynosdbAccountPrivileges(String name, CynosdbAccountPrivilegesArgs args, CustomResourceOptions options)
    
    type: tencentcloud:CynosdbAccountPrivileges
    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 CynosdbAccountPrivilegesArgs
    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 CynosdbAccountPrivilegesArgs
    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 CynosdbAccountPrivilegesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CynosdbAccountPrivilegesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CynosdbAccountPrivilegesArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    AccountName string
    Account.
    ClusterId string
    Cluster ID.
    GlobalPrivileges List<string>
    Array of global permissions.
    CynosdbAccountPrivilegesId string
    ID of the resource.
    DatabasePrivileges List<CynosdbAccountPrivilegesDatabasePrivilege>
    Array of database permissions.
    Host string
    Host, default %.
    TablePrivileges List<CynosdbAccountPrivilegesTablePrivilege>
    array of table permissions.
    AccountName string
    Account.
    ClusterId string
    Cluster ID.
    GlobalPrivileges []string
    Array of global permissions.
    CynosdbAccountPrivilegesId string
    ID of the resource.
    DatabasePrivileges []CynosdbAccountPrivilegesDatabasePrivilegeArgs
    Array of database permissions.
    Host string
    Host, default %.
    TablePrivileges []CynosdbAccountPrivilegesTablePrivilegeArgs
    array of table permissions.
    accountName String
    Account.
    clusterId String
    Cluster ID.
    globalPrivileges List<String>
    Array of global permissions.
    cynosdbAccountPrivilegesId String
    ID of the resource.
    databasePrivileges List<CynosdbAccountPrivilegesDatabasePrivilege>
    Array of database permissions.
    host String
    Host, default %.
    tablePrivileges List<CynosdbAccountPrivilegesTablePrivilege>
    array of table permissions.
    accountName string
    Account.
    clusterId string
    Cluster ID.
    globalPrivileges string[]
    Array of global permissions.
    cynosdbAccountPrivilegesId string
    ID of the resource.
    databasePrivileges CynosdbAccountPrivilegesDatabasePrivilege[]
    Array of database permissions.
    host string
    Host, default %.
    tablePrivileges CynosdbAccountPrivilegesTablePrivilege[]
    array of table permissions.
    account_name str
    Account.
    cluster_id str
    Cluster ID.
    global_privileges Sequence[str]
    Array of global permissions.
    cynosdb_account_privileges_id str
    ID of the resource.
    database_privileges Sequence[CynosdbAccountPrivilegesDatabasePrivilegeArgs]
    Array of database permissions.
    host str
    Host, default %.
    table_privileges Sequence[CynosdbAccountPrivilegesTablePrivilegeArgs]
    array of table permissions.
    accountName String
    Account.
    clusterId String
    Cluster ID.
    globalPrivileges List<String>
    Array of global permissions.
    cynosdbAccountPrivilegesId String
    ID of the resource.
    databasePrivileges List<Property Map>
    Array of database permissions.
    host String
    Host, default %.
    tablePrivileges List<Property Map>
    array of table permissions.

    Outputs

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

    Get an existing CynosdbAccountPrivileges 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?: CynosdbAccountPrivilegesState, opts?: CustomResourceOptions): CynosdbAccountPrivileges
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_name: Optional[str] = None,
            cluster_id: Optional[str] = None,
            cynosdb_account_privileges_id: Optional[str] = None,
            database_privileges: Optional[Sequence[CynosdbAccountPrivilegesDatabasePrivilegeArgs]] = None,
            global_privileges: Optional[Sequence[str]] = None,
            host: Optional[str] = None,
            table_privileges: Optional[Sequence[CynosdbAccountPrivilegesTablePrivilegeArgs]] = None) -> CynosdbAccountPrivileges
    func GetCynosdbAccountPrivileges(ctx *Context, name string, id IDInput, state *CynosdbAccountPrivilegesState, opts ...ResourceOption) (*CynosdbAccountPrivileges, error)
    public static CynosdbAccountPrivileges Get(string name, Input<string> id, CynosdbAccountPrivilegesState? state, CustomResourceOptions? opts = null)
    public static CynosdbAccountPrivileges get(String name, Output<String> id, CynosdbAccountPrivilegesState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:CynosdbAccountPrivileges    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:
    AccountName string
    Account.
    ClusterId string
    Cluster ID.
    CynosdbAccountPrivilegesId string
    ID of the resource.
    DatabasePrivileges List<CynosdbAccountPrivilegesDatabasePrivilege>
    Array of database permissions.
    GlobalPrivileges List<string>
    Array of global permissions.
    Host string
    Host, default %.
    TablePrivileges List<CynosdbAccountPrivilegesTablePrivilege>
    array of table permissions.
    AccountName string
    Account.
    ClusterId string
    Cluster ID.
    CynosdbAccountPrivilegesId string
    ID of the resource.
    DatabasePrivileges []CynosdbAccountPrivilegesDatabasePrivilegeArgs
    Array of database permissions.
    GlobalPrivileges []string
    Array of global permissions.
    Host string
    Host, default %.
    TablePrivileges []CynosdbAccountPrivilegesTablePrivilegeArgs
    array of table permissions.
    accountName String
    Account.
    clusterId String
    Cluster ID.
    cynosdbAccountPrivilegesId String
    ID of the resource.
    databasePrivileges List<CynosdbAccountPrivilegesDatabasePrivilege>
    Array of database permissions.
    globalPrivileges List<String>
    Array of global permissions.
    host String
    Host, default %.
    tablePrivileges List<CynosdbAccountPrivilegesTablePrivilege>
    array of table permissions.
    accountName string
    Account.
    clusterId string
    Cluster ID.
    cynosdbAccountPrivilegesId string
    ID of the resource.
    databasePrivileges CynosdbAccountPrivilegesDatabasePrivilege[]
    Array of database permissions.
    globalPrivileges string[]
    Array of global permissions.
    host string
    Host, default %.
    tablePrivileges CynosdbAccountPrivilegesTablePrivilege[]
    array of table permissions.
    account_name str
    Account.
    cluster_id str
    Cluster ID.
    cynosdb_account_privileges_id str
    ID of the resource.
    database_privileges Sequence[CynosdbAccountPrivilegesDatabasePrivilegeArgs]
    Array of database permissions.
    global_privileges Sequence[str]
    Array of global permissions.
    host str
    Host, default %.
    table_privileges Sequence[CynosdbAccountPrivilegesTablePrivilegeArgs]
    array of table permissions.
    accountName String
    Account.
    clusterId String
    Cluster ID.
    cynosdbAccountPrivilegesId String
    ID of the resource.
    databasePrivileges List<Property Map>
    Array of database permissions.
    globalPrivileges List<String>
    Array of global permissions.
    host String
    Host, default %.
    tablePrivileges List<Property Map>
    array of table permissions.

    Supporting Types

    CynosdbAccountPrivilegesDatabasePrivilege, CynosdbAccountPrivilegesDatabasePrivilegeArgs

    Db string
    Database.
    Privileges List<string>
    Database privileges.
    Db string
    Database.
    Privileges []string
    Database privileges.
    db String
    Database.
    privileges List<String>
    Database privileges.
    db string
    Database.
    privileges string[]
    Database privileges.
    db str
    Database.
    privileges Sequence[str]
    Database privileges.
    db String
    Database.
    privileges List<String>
    Database privileges.

    CynosdbAccountPrivilegesTablePrivilege, CynosdbAccountPrivilegesTablePrivilegeArgs

    Db string
    Database name.
    Privileges List<string>
    Table privileges.
    TableName string
    Table name.
    Db string
    Database name.
    Privileges []string
    Table privileges.
    TableName string
    Table name.
    db String
    Database name.
    privileges List<String>
    Table privileges.
    tableName String
    Table name.
    db string
    Database name.
    privileges string[]
    Table privileges.
    tableName string
    Table name.
    db str
    Database name.
    privileges Sequence[str]
    Table privileges.
    table_name str
    Table name.
    db String
    Database name.
    privileges List<String>
    Table privileges.
    tableName String
    Table name.

    Import

    cynosdb account_privileges can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/cynosdbAccountPrivileges:CynosdbAccountPrivileges account_privileges account_privileges_id
    

    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