Skip to content

Commit aedeb5e

Browse files
tongyimingmikatong
andauthored
fix: add db_major_version (#1178)
Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 5f77b52 commit aedeb5e

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

tencentcloud/resource_tc_postgresql_instance.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,14 @@ func resourceTencentCloudPostgresqlInstance() *schema.Resource {
193193
Description: "Version of the postgresql database engine. Valid values: `10.4`, `11.8`, `12.4`.",
194194
},
195195
"db_major_vesion": {
196+
Type: schema.TypeString,
197+
Optional: true,
198+
Computed: true,
199+
Deprecated: "`db_major_vesion` will be deprecated, use `db_major_version` instead.",
200+
Description: "PostgreSQL major version number. Valid values: 10, 11, 12, 13. " +
201+
"If it is specified, an instance running the latest kernel of PostgreSQL DBMajorVersion will be created.",
202+
},
203+
"db_major_version": {
196204
Type: schema.TypeString,
197205
Optional: true,
198206
Computed: true,
@@ -459,6 +467,9 @@ func resourceTencentCloudPostgresqlInstanceCreate(d *schema.ResourceData, meta i
459467
if v, ok := d.GetOk("db_major_vesion"); ok {
460468
dbMajorVersion = v.(string)
461469
}
470+
if v, ok := d.GetOk("db_major_version"); ok {
471+
dbMajorVersion = v.(string)
472+
}
462473
if v, ok := d.GetOk("db_kernel_version"); ok {
463474
dbKernelVersion = v.(string)
464475
}
@@ -941,7 +952,7 @@ func resourceTencentCloudPostgresqlInstanceUpdate(d *schema.ResourceData, meta i
941952
paramEntrys["max_standby_streaming_delay"] = strconv.Itoa(v.(int))
942953
}
943954
}
944-
if d.HasChange("db_major_vesion") || d.HasChange("db_kernel_version") {
955+
if d.HasChange("db_major_vesion") || d.HasChange("db_major_version") || d.HasChange("db_kernel_version") {
945956
return fmt.Errorf("Not support change db major version or kernel version.")
946957
}
947958

@@ -1025,6 +1036,7 @@ func resourceTencentCloudPostgresqlInstanceRead(d *schema.ResourceData, meta int
10251036
_ = d.Set("subnet_id", instance.SubnetId)
10261037
_ = d.Set("engine_version", instance.DBVersion)
10271038
_ = d.Set("db_major_vesion", instance.DBMajorVersion)
1039+
_ = d.Set("db_major_version", instance.DBMajorVersion)
10281040
_ = d.Set("db_kernel_version", instance.DBKernelVersion)
10291041
_ = d.Set("name", instance.DBInstanceName)
10301042
_ = d.Set("charset", instance.DBCharset)

tencentcloud/resource_tc_postgresql_instance_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ func TestAccTencentCloudPostgresqlInstanceResource(t *testing.T) {
112112
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "availability_zone"),
113113
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "private_access_ip"),
114114
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "private_access_port"),
115+
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "db_major_vesion"),
116+
resource.TestCheckResourceAttrSet(testPostgresqlInstanceResourceKey, "db_major_version"),
115117
resource.TestCheckResourceAttr(testPostgresqlInstanceResourceKey, "backup_plan.#", "1"),
116118
resource.TestCheckResourceAttr(testPostgresqlInstanceResourceKey, "backup_plan.0.min_backup_start_time", "00:10:11"),
117119
resource.TestCheckResourceAttr(testPostgresqlInstanceResourceKey, "backup_plan.0.max_backup_start_time", "01:10:11"),

website/docs/r/postgresql_instance.html.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ The following arguments are supported:
156156
* `charge_type` - (Optional, String, ForceNew) Pay type of the postgresql instance. For now, only `POSTPAID_BY_HOUR` is valid.
157157
* `charset` - (Optional, String, ForceNew) Charset of the root account. Valid values are `UTF8`,`LATIN1`.
158158
* `db_kernel_version` - (Optional, String) PostgreSQL kernel version number. If it is specified, an instance running kernel DBKernelVersion will be created.
159-
* `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.
159+
* `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.
160+
* `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.
160161
* `db_node_set` - (Optional, Set) Specify instance node info for disaster migration.
161162
* `engine_version` - (Optional, String, ForceNew) Version of the postgresql database engine. Valid values: `10.4`, `11.8`, `12.4`.
162163
* `kms_key_id` - (Optional, String) KeyId of the custom key.

0 commit comments

Comments
 (0)