Skip to content

Commit 99cd9ee

Browse files
committed
Merge branch 'master' of github.com:terraform-providers/terraform-provider-tencentcloud
2 parents bd7d868 + e170bd9 commit 99cd9ee

File tree

66 files changed

+1254
-941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1254
-941
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ FEATURES:
44

55
* **New Data Source**: `tencentcloud_availability_regions`
66

7+
ENHANCEMENTS:
8+
9+
* Data Source: `tencentcloud_redis_instances` add new argument `charge_type` to support prepaid type.
10+
* Resource: `tencentcloud_redis_instance` add new argument `charge_type`, `prepaid_period` and `force_delete` to support prepaid type.
11+
* Resource: `tencentcloud_mysql_instance` add new argument `force_delete` to support soft deletion.
12+
* Resource: `tencentcloud_mysql_readonly_instance` add new argument `force_delete` to support soft deletion.
13+
14+
BUG FIXES:
15+
16+
* Resource: `tencentcloud_instance` fix `allocate_public_ip` inconsistency when eip is attached to the cvm.
17+
18+
DEPRECATED:
19+
* Data Source: `tencentcloud_mysql_instances`: optional argument `pay_type` is no longer supported, replace by `charge_type`.
20+
* Resource: `tencentcloud_mysql_instance`: optional arguments `pay_type` and `period` are no longer supported, replace by `charge_type` and `prepaid_period`.
21+
* Resource: `tencentcloud_mysql_readonly_instance`: optional arguments `pay_type` and `period` are no longer supported, replace by `charge_type` and `prepaid_period`.
22+
* Resource: `tencentcloud_tcaplus_group` replace by `tencentcloud_tcaplus_tablegroup`
23+
* Data Source: `tencentcloud_tcaplus_groups` replace by `tencentcloud_tcaplus_tablegroups`
24+
* Resource: `tencentcloud_tcaplus_tablegroup`,`tencentcloud_tcaplus_idl` and `tencentcloud_tcaplus_table` arguments `group_id`/`group_name` replace by `tablegroup_id`/`tablegroup_name`
25+
* Data Source: `tencentcloud_tcaplus_groups`,`tencentcloud_tcaplus_idls` and `tencentcloud_tcaplus_tables` arguments `group_id`/`group_name` replace by `tablegroup_id`/`tablegroup_name`
26+
727
## 1.35.1 (June 02, 2020)
828

929
ENHANCEMENTS:

examples/tencentcloud-redis/main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,19 @@ data "tencentcloud_redis_instances" "redis-tags" {
2626
zone = var.availability_zone
2727
tags = tencentcloud_redis_instance.redis_instance_test.tags
2828
}
29+
30+
resource "tencentcloud_redis_instance" "redis_instance_prepaid_test" {
31+
availability_zone = var.availability_zone
32+
type_id = 2
33+
password = "test12345789"
34+
mem_size = 8192
35+
name = "terrform_prepaid_test"
36+
port = 6379
37+
charge_type = "PREPAID"
38+
prepaid_period = 1
39+
force_delete = true
40+
41+
tags = {
42+
"test" = "prepaid test"
43+
}
44+
}
Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
resource "tencentcloud_vpc" "foo" {
2-
name = var.instance_name
3-
cidr_block = var.vpc_cidr
4-
}
5-
6-
resource "tencentcloud_subnet" "subnet" {
7-
name = var.instance_name
8-
vpc_id = tencentcloud_vpc.foo.id
1+
data "tencentcloud_vpc_subnets" "vpc" {
2+
is_default = true
93
availability_zone = var.availability_zone
10-
cidr_block = var.subnet_cidr
11-
is_multicast = false
124
}
135

14-
resource "tencentcloud_tcaplus_application" "test_app" {
6+
resource "tencentcloud_tcaplus_cluster" "test_cluster" {
157
idl_type = "PROTO"
16-
app_name = "tf_tcaplus_g_table"
17-
vpc_id = tencentcloud_vpc.foo.id
18-
subnet_id = tencentcloud_subnet.subnet.id
8+
cluster_name = "tf_tcaplus_g_table"
9+
vpc_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.vpc_id
10+
subnet_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.subnet_id
1911
password = "1qaA2k1wgvfa3ZZZ"
2012
old_password_expire_last = 3600
2113
}
2214

2315
resource "tencentcloud_tcaplus_idl" "test_idl" {
24-
app_id = tencentcloud_tcaplus_application.test_app.id
25-
zone_id = tencentcloud_tcaplus_zone.test_zone.id
16+
cluster_id = tencentcloud_tcaplus_cluster.test_cluster.id
17+
tablegroup_id = tencentcloud_tcaplus_tablegroup.test_tablegroup.id
2618
file_name = "tf_idl_test_guagua"
2719
file_type = "PROTO"
2820
file_ext_type = "proto"
@@ -55,20 +47,20 @@ resource "tencentcloud_tcaplus_idl" "test_idl" {
5547
EOF
5648
}
5749

58-
resource "tencentcloud_tcaplus_zone" "test_zone" {
59-
app_id = tencentcloud_tcaplus_application.test_app.id
60-
zone_name = "tf_test_zone_name_guagua"
50+
resource "tencentcloud_tcaplus_tablegroup" "test_tablegroup" {
51+
cluster_id = tencentcloud_tcaplus_cluster.test_cluster.id
52+
tablegroup_name = "tf_test_tablegroup"
6153
}
6254

6355
resource "tencentcloud_tcaplus_table" "test_table" {
64-
app_id = tencentcloud_tcaplus_application.test_app.id
65-
zone_id = tencentcloud_tcaplus_zone.test_zone.id
66-
table_name = "tb_online_guagua"
67-
table_type = "GENERIC"
68-
description = "test"
69-
idl_id = tencentcloud_tcaplus_idl.test_idl.id
70-
table_idl_type = "PROTO"
71-
reserved_read_qps = 1000
72-
reserved_write_qps = 20
73-
reserved_volume = 1
56+
cluster_id = tencentcloud_tcaplus_cluster.test_cluster.id
57+
tablegroup_id = tencentcloud_tcaplus_tablegroup.test_tablegroup.id
58+
table_name = "tb_online_guagua"
59+
table_type = "GENERIC"
60+
description = "test"
61+
idl_id = tencentcloud_tcaplus_idl.test_idl.id
62+
table_idl_type = "PROTO"
63+
reserved_read_cu = 1000
64+
reserved_write_cu = 20
65+
reserved_volume = 1
7466
}
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
variable "availability_zone" {
22
default = "ap-shanghai-2"
3-
}
4-
variable "instance_name" {
5-
default = "vpc_test"
6-
}
7-
variable "vpc_cidr" {
8-
default = "10.1.0.0/16"
9-
}
10-
variable "subnet_cidr" {
11-
default = "10.1.1.0/24"
12-
}
3+
}

examples/tencentcloud-vpn/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ data "tencentcloud_vpn_connections" "example" {
6464
id = tencentcloud_vpn_connection.example.id
6565
}
6666

67-
# The example below shows how to create a vpng gateway in ccn type if it is needed. Then could be used when creating
67+
# The example below shows how to create a vpn gateway in ccn type if it is needed. Then could be used when creating
6868
# vpn tunnel in the usual way.
6969
resource tencentcloud_vpn_gateway ccn_vpngw_example {
7070
name = "ccn-vpngw-example"

main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"github.com/hashicorp/terraform-plugin-sdk/plugin"
55
"github.com/hashicorp/terraform-plugin-sdk/terraform"
6-
76
"github.com/terraform-providers/terraform-provider-tencentcloud/tencentcloud"
87
)
98

tencentcloud/basic_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,16 @@ resource "tencentcloud_mysql_instance" "default" {
137137
availability_zone = var.availability_zone
138138
}
139139
`
140+
141+
const mysqlInstanceHighPerformancePrepaidTestCase = defaultVpcVariable + `
142+
resource "tencentcloud_mysql_instance" "default" {
143+
mem_size = 1000
144+
volume_size = 50
145+
pay_type = 0
146+
instance_name = var.instance_name
147+
engine_version = "5.7"
148+
root_password = "0153Y474"
149+
availability_zone = var.availability_zone
150+
force_delete = true
151+
}
152+
`

tencentcloud/connectivity/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (me *TencentCloudClient) UseCosClient() *s3.S3 {
9393
resolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) {
9494
if service == endpoints.S3ServiceID {
9595
return endpoints.ResolvedEndpoint{
96-
URL: fmt.Sprintf("http://cos.%s.myqcloud.com", region),
96+
URL: fmt.Sprintf("https://cos.%s.myqcloud.com", region),
9797
SigningRegion: region,
9898
}, nil
9999
}

tencentcloud/data_source_tc_mysql_instance.go

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,15 @@ func dataSourceTencentCloudMysqlInstance() *schema.Resource {
5050
"pay_type": {
5151
Type: schema.TypeInt,
5252
Optional: true,
53+
Deprecated: "It has been deprecated from version 1.36.0.",
5354
ValidateFunc: validateAllowedIntValue([]int{0, 1}),
54-
Description: "Pay type of instance, 0: prepay, 1: postpay. NOTES: Only prepay is supported.",
55+
Description: "Pay type of instance, 0: prepay, 1: postpay.",
56+
},
57+
"charge_type": {
58+
Type: schema.TypeString,
59+
Optional: true,
60+
ValidateFunc: validateAllowedStringValue([]string{MYSQL_CHARGE_TYPE_PREPAID, MYSQL_CHARGE_TYPE_POSTPAID}),
61+
Description: "Pay type of instance, valid values are `PREPAID` and `POSTPAID`.",
5562
},
5663
"instance_name": {
5764
Type: schema.TypeString,
@@ -222,7 +229,12 @@ func dataSourceTencentCloudMysqlInstance() *schema.Resource {
222229
"pay_type": {
223230
Type: schema.TypeInt,
224231
Computed: true,
225-
Description: "Pay type of instance, 0: prepay, 1: postpay. NOTES: Only prepay is supported.",
232+
Description: "Pay type of instance, 0: prepaid, 1: postpaid.",
233+
},
234+
"charge_type": {
235+
Type: schema.TypeString,
236+
Computed: true,
237+
Description: "Pay type of instance.",
226238
},
227239
"create_time": {
228240
Type: schema.TypeString,
@@ -295,6 +307,16 @@ func dataSourceTencentCloudMysqlInstanceRead(d *schema.ResourceData, meta interf
295307
payTypeValue := uint64(payType.(int))
296308
request.PayTypes = []*uint64{&payTypeValue}
297309
}
310+
if chargeType, ok := d.GetOk("charge_type"); ok {
311+
var payType int
312+
if chargeType == MYSQL_CHARGE_TYPE_PREPAID {
313+
payType = MysqlPayByMonth
314+
} else {
315+
payType = MysqlPayByUse
316+
}
317+
payTypeValue := uint64(payType)
318+
request.PayTypes = []*uint64{&payTypeValue}
319+
}
298320
if instanceName, ok := d.GetOk("instance_name"); ok {
299321
instanceNameValue := instanceName.(string)
300322
request.InstanceNames = []*string{&instanceNameValue}
@@ -338,41 +360,39 @@ func dataSourceTencentCloudMysqlInstanceRead(d *schema.ResourceData, meta interf
338360
return fmt.Errorf("api[DescribeDBInstances]fail, return %s", err.Error())
339361
}
340362

341-
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",
342-
logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
343-
344363
instanceDetails := response.Response.Items
345364
instanceList := make([]map[string]interface{}, 0, len(instanceDetails))
346365
ids := make([]string, 0, len(instanceDetails))
347366
for _, item := range instanceDetails {
348367
mapping := map[string]interface{}{
349-
"mysql_id": *item.InstanceId,
350-
"instance_name": *item.InstanceName,
368+
"mysql_id": item.InstanceId,
369+
"instance_name": item.InstanceName,
351370
"instance_role": MYSQL_ROLE_MAP[*item.InstanceType],
352-
"init_flag": *item.InitFlag,
353-
"status": *item.Status,
354-
"zone": *item.Zone,
355-
"auto_renew_flag": *item.AutoRenew,
356-
"engine_version": *item.EngineVersion,
357-
"cpu_core_count": *item.Cpu,
358-
"memory_size": *item.Memory,
359-
"volume_size": *item.Volume,
360-
"internet_status": *item.WanStatus,
361-
"internet_host": *item.WanDomain,
362-
"internet_port": *item.WanPort,
363-
"intranet_ip": *item.Vip,
364-
"intranet_port": *item.Vport,
365-
"project_id": *item.ProjectId,
366-
"vpc_id": *item.UniqVpcId,
367-
"subnet_id": *item.UniqSubnetId,
368-
"slave_sync_mode": *item.ProtectMode,
369-
"device_type": *item.DeviceType,
370-
"pay_type": *item.PayType,
371-
"create_time": *item.CreateTime,
372-
"dead_line_time": *item.DeadlineTime,
371+
"init_flag": item.InitFlag,
372+
"status": item.Status,
373+
"zone": item.Zone,
374+
"auto_renew_flag": item.AutoRenew,
375+
"engine_version": item.EngineVersion,
376+
"cpu_core_count": item.Cpu,
377+
"memory_size": item.Memory,
378+
"volume_size": item.Volume,
379+
"internet_status": item.WanStatus,
380+
"internet_host": item.WanDomain,
381+
"internet_port": item.WanPort,
382+
"intranet_ip": item.Vip,
383+
"intranet_port": item.Vport,
384+
"project_id": item.ProjectId,
385+
"vpc_id": item.UniqVpcId,
386+
"subnet_id": item.UniqSubnetId,
387+
"slave_sync_mode": item.ProtectMode,
388+
"device_type": item.DeviceType,
389+
"pay_type": item.PayType,
390+
"create_time": item.CreateTime,
391+
"dead_line_time": item.DeadlineTime,
392+
"charge_type": MYSQL_CHARGE_TYPE[int(*item.PayType)],
373393
}
374394
if item.MasterInfo != nil {
375-
mapping["master_instance_id"] = *item.MasterInfo.InstanceId
395+
mapping["master_instance_id"] = item.MasterInfo.InstanceId
376396
} else {
377397
mapping["master_instance_id"] = ""
378398
}

tencentcloud/data_source_tc_mysql_instance_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func TestAccTencentCloudMysqlInstanceDataSource(t *testing.T) {
2323
resource.TestCheckResourceAttr("data.tencentcloud_mysql_instance.mysql", "instance_list.0.engine_version", "5.7"),
2424
resource.TestCheckResourceAttrSet("data.tencentcloud_mysql_instance.mysql", "instance_list.0.vpc_id"),
2525
resource.TestCheckResourceAttrSet("data.tencentcloud_mysql_instance.mysql", "instance_list.0.subnet_id"),
26+
resource.TestCheckResourceAttrSet("data.tencentcloud_mysql_instance.mysql", "instance_list.0.auto_renew_flag"),
2627
),
2728
},
2829
},

0 commit comments

Comments
 (0)