Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tencentcloud/resource_tc_postgresql_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ func resourceTencentCloudPostgresqlInstance() *schema.Resource {
Description: "Version of the postgresql database engine. Valid values: `10.4`, `11.8`, `12.4`.",
},
"db_major_vesion": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Deprecated: "`db_major_vesion` will be deprecated, use `db_major_version` instead.",
Description: "PostgreSQL major version number. Valid values: 10, 11, 12, 13. " +
"If it is specified, an instance running the latest kernel of PostgreSQL DBMajorVersion will be created.",
},
"db_major_version": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Expand Down Expand Up @@ -459,6 +467,9 @@ func resourceTencentCloudPostgresqlInstanceCreate(d *schema.ResourceData, meta i
if v, ok := d.GetOk("db_major_vesion"); ok {
dbMajorVersion = v.(string)
}
if v, ok := d.GetOk("db_major_version"); ok {
dbMajorVersion = v.(string)
}
if v, ok := d.GetOk("db_kernel_version"); ok {
dbKernelVersion = v.(string)
}
Expand Down Expand Up @@ -941,7 +952,7 @@ func resourceTencentCloudPostgresqlInstanceUpdate(d *schema.ResourceData, meta i
paramEntrys["max_standby_streaming_delay"] = strconv.Itoa(v.(int))
}
}
if d.HasChange("db_major_vesion") || d.HasChange("db_kernel_version") {
if d.HasChange("db_major_vesion") || d.HasChange("db_major_version") || d.HasChange("db_kernel_version") {
return fmt.Errorf("Not support change db major version or kernel version.")
}

Expand Down Expand Up @@ -1025,6 +1036,7 @@ func resourceTencentCloudPostgresqlInstanceRead(d *schema.ResourceData, meta int
_ = d.Set("subnet_id", instance.SubnetId)
_ = d.Set("engine_version", instance.DBVersion)
_ = d.Set("db_major_vesion", instance.DBMajorVersion)
_ = d.Set("db_major_version", instance.DBMajorVersion)
_ = d.Set("db_kernel_version", instance.DBKernelVersion)
_ = d.Set("name", instance.DBInstanceName)
_ = d.Set("charset", instance.DBCharset)
Expand Down
2 changes: 2 additions & 0 deletions tencentcloud/resource_tc_postgresql_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func TestAccTencentCloudPostgresqlInstanceResource(t *testing.T) {
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "availability_zone"),
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "private_access_ip"),
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "private_access_port"),
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "db_major_vesion"),
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "db_major_version"),
resource.TestCheckResourceAttr(testPostgresqlInstanceResourceKey, "backup_plan.#", "1"),
resource.TestCheckResourceAttr(testPostgresqlInstanceResourceKey, "backup_plan.0.min_backup_start_time", "00:10:11"),
resource.TestCheckResourceAttr(testPostgresqlInstanceResourceKey, "backup_plan.0.max_backup_start_time", "01:10:11"),
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/postgresql_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ The following arguments are supported:
* `charge_type` - (Optional, String, ForceNew) Pay type of the postgresql instance. For now, only `POSTPAID_BY_HOUR` is valid.
* `charset` - (Optional, String, ForceNew) Charset of the root account. Valid values are `UTF8`,`LATIN1`.
* `db_kernel_version` - (Optional, String) PostgreSQL kernel version number. If it is specified, an instance running kernel DBKernelVersion will be created.
* `db_major_vesion` - (Optional, String) PostgreSQL major version number. Valid values: 10, 11, 12, 13. If it is specified, an instance running the latest kernel of PostgreSQL DBMajorVersion will be created.
* `db_major_version` - (Optional, String) PostgreSQL major version number. Valid values: 10, 11, 12, 13. If it is specified, an instance running the latest kernel of PostgreSQL DBMajorVersion will be created.
* `db_major_vesion` - (Optional, String, **Deprecated**) `db_major_vesion` will be deprecated, use `db_major_version` instead. PostgreSQL major version number. Valid values: 10, 11, 12, 13. If it is specified, an instance running the latest kernel of PostgreSQL DBMajorVersion will be created.
* `db_node_set` - (Optional, Set) Specify instance node info for disaster migration.
* `engine_version` - (Optional, String, ForceNew) Version of the postgresql database engine. Valid values: `10.4`, `11.8`, `12.4`.
* `kms_key_id` - (Optional, String) KeyId of the custom key.
Expand Down