描述
示例
resource "tencentcloud_cynosdb_account" "account" {cluster_id = tencentcloud_cynosdb_cluster.example.idaccount_name = "cloudapp_test"account_password = "Password@1234"host = "%"description = "cloudapp test"max_user_connections = 2}resource "tencentcloud_cynosdb_account_privileges" "account_privileges" {cluster_id = tencentcloud_cynosdb_cluster.example.idaccount_name = tencentcloud_cynosdb_account.account.account_namehost = "%"global_privileges = ["CREATE","DROP","ALTER","CREATE TEMPORARY TABLES","CREATE VIEW"]# database_privileges {# db = "users"# privileges = [# "DROP",# "REFERENCES",# "INDEX",# "CREATE VIEW",# "INSERT",# "EVENT"# ]# }# table_privileges {# db = "users"# table_name = "tb_user_name"# privileges = [# "ALTER",# "REFERENCES",# "SHOW VIEW"# ]# }}
参数说明
类型 | 名称 | 数据类型 | 说明 |
必填 | region | string | 地域,如:ap-guangzhou,默认使用 provider 中定义的 region
也可以在 resource 中指定地域,覆盖默认设置 |
必填 | account_name | string | 账户名 |
必填 | cluster_id | string | 集群 ID |
必填 | global_privileges | string[] | 全局权限数组 |
可选 | availability_zone | string | 可用区 |
可选 | count | int | 资源数量,默认为 1
如果为 0 则不创建资源 |
可选 | activity_id | int | 计费活动 ID,保留字段 |
可选 | host | string | 主机,默认为% |
可选 | database_privileges | Schema[] | 数据库权限数组 Schema 类型详见:DatabasePrivilegesSchema |
可选 | table_privileges | Schema[] | 表权限数组 Schema 类型详见:TablePrivilegesSchema |
生成 | id | string | 资源实例 ID |
生成 | create_time | string | 资源创建时间 |
数据结构
DatabasePrivilegesSchema
参数说明
类型 | 名称 | 数据类型 | 说明 |
必填 | db | string | 数据库名 |
必填 | privileges | string[] | 权限组 |
TablePrivilegesSchema
参数说明
类型 | 名称 | 数据类型 | 说明 |
必填 | db | string | 数据库名 |
必填 | table_name | string | 表名 |
必填 | privileges | string[] | 权限组 |