tencentcloud_postgresql_instance

最近更新时间:2025-09-04 14:56:13

我的收藏

描述

云数据库 PostgreSQL,产品介绍

示例

resource "tencentcloud_postgresql_instance" "foo" {
availability_zone = var.app_target.availability_zone
vpc_id = var.app_target.vpc_id
subnet_id = var.app_target.subnet_id
engine_version = "14.2"
root_password = random_password.db.result
charset = "UTF8"
spec_code = "cdb.pg.ts1.8g"
security_groups = [var.app_sg.security_group_id]
storage = 100

db_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"