描述
云数据库 PostgreSQL,产品介绍
示例
resource "tencentcloud_postgresql_instance" "foo" {availability_zone = var.app_target.availability_zonevpc_id = var.app_target.vpc_idsubnet_id = var.app_target.subnet_idengine_version = "14.2"root_password = random_password.db.resultcharset = "UTF8"spec_code = "cdb.pg.ts1.8g"security_groups = [var.app_sg.security_group_id]storage = 100db_node_set {role = "Primary"zone = var.app_target.availability_zone}db_node_set {zone = "ap-guangzhou-3"}}
参数说明
类型 | 名称 | 数据类型 | 说明 |
必填 | region | string | 地域,如:ap-guangzhou,默认使用 provider 中定义的 region
也可以在 resource 中指定地域,覆盖默认设置 |
必填 | availability_zone | string | 可用区 |
必填 | security_groups | string[] | 安全组 ID 列表 |
必填 | storage | int | 实例容量大小,单位:GB |
必填 | spec_code | string | 售卖规格,如:cdb.pg.z1.2g TencentCloud Terraform 中没有此参数 |
必填 | root_password | string | root 用户密码 |
可选 | count | int | 资源数量,默认为 1
如果为 0 则不创建资源 |
可选 | activity_id | int | 计费活动 ID,保留字段 |
可选 | charge_type | enum | 购买方式 枚举值: PREPAID POSTPAID_BY_HOUR |
可选 | charge_period | int | 预付费购买时长,单位:月 |
可选 | auto_renew_flag | 0 | 1 | 自动续费标记,可选值为: 0:不自动续费 1:自动续费。 |
可选 | engine_version | string | PostgreSQL 版本,支持的版本: 10.4 , 11.8 , 12.4 , 14.2 |
可选 | db_major_version | string | PostgreSQL 主要版本 |
可选 | db_kernel_version | string | 数据库内核版本 |
可选 | vpc_id | string | VPC ID |
可选 | subnet_id | string | 子网 ID |
可选 | root_user | string | root 用户名 |
可选 | charset | enum | 实例字符集,目前只支持:UTF8、LATIN1。 枚举值: UTF8 LATIN1 |
可选 | need_support_tde | 0 | 1 | 是否需要支持数据透明加密 1:是 0:否(默认) |
可选 | kms_key_id | string | 自定义密钥的 KeyId,若选择自定义密匙加密,则需要传入自定义密匙的 KeyId,KeyId 是 CMK 的唯一标识。 |
可选 | kms_region | string | 使用 KMS 服务的地域,KMSRegion 为空默认使用本地域的 KMS,本地域不支持的情况下需自选其他 KMS 支持的地域。 |
可选 | db_node_set | Schema[] | 节点配置,支持跨多可用区时需配置 Schema 类型详见:DBNodeSetSchema |
可选 | force_delete | boolean | 是否直接删除,仅预付费购买的资源生效,选是则直接删除,不在回收站保留
按量付费资源直接删除 |
生成 | id | string | 资源实例 ID |
生成 | create_time | string | 资源创建时间 |
生成 | name | string | 实例名称 |
生成 | public_access_switch | boolean | 是否是 public 网络类型 true:public(基础网络或私有网络的外网地址) false:private(私有网络内网地址 |
生成 | public_access_host | string | IP 地址,只有 public_access_switch = true 时存在 |
生成 | public_access_port | string | 连接 Port 地址,只有 public_access_switch = true 时存在 |
生成 | private_access_ip | string | IP 地址,只有 public_access_switch = false 时存在 |
生成 | private_access_port | string | 连接 Port 地址,只有 public_access_switch = false 时存在 |
数据结构
DBNodeSetSchema
参数说明
类型 | 名称 | 数据类型 |
必填 | zone | string |
可选 | role | "Primary" | "Standby" |