Skip to content

Commit e011244

Browse files
committed
Merge remote-tracking branch 'upstream/master' into vod
2 parents cf68732 + 79c8f44 commit e011244

13 files changed

+179
-58
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22

33
FEATURES:
44

5-
* **New Resource**: `tencentcloud_vod_adaptive_dynamic_streaming_template`
5+
* **New Resource**: `tencentcloud_vod_adaptive_dynamic_streaming_template`.
66
* **New Resource**: `tencentcloud_vod_procedure_template`.
77
* **New Resource**: `tencentcloud_vod_snapshot_by_time_offset_template`.
88
* **New Resource**: `tencentcloud_vod_image_sprite_template`.
99
* **New Resource**: `tencentcloud_vod_super_player_config`.
10-
* **New Data Source**: `tencentcloud_vod_adaptive_dynamic_streaming_templates`
10+
* **New Data Source**: `tencentcloud_vod_adaptive_dynamic_streaming_templates`.
1111
* **New Data Source**: `tencentcloud_vod_image_sprite_templates`.
1212
* **New Data Source**: `tencentcloud_vod_procedure_templates`.
1313
* **New Data Source**: `tencentcloud_vod_snapshot_by_time_offset_templates`.
1414
* **New Data Source**: `tencentcloud_vod_super_player_configs`.
1515

16+
ENHANCEMENTS:
17+
18+
* Resource: `tencentcloud_mysql_instance` modify argument `engine_version` to support mysql 8.0.
19+
* Resource: `tencentcloud_clb_listener_rule` add new argument `forward_type` to support backend protocol([#522](https://github.com/tencentcloudstack/terraform-provider-tencentcloud/issues/522))
20+
* Resource: `tencentcloud_instance` add new argument `keep_image_login` to support keeping image login.
21+
1622
## 1.44.0 (September 25, 2020)
1723

1824
FEATURES:

tencentcloud/data_source_tc_mysql_instance.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ func dataSourceTencentCloudMysqlInstance() *schema.Resource {
6868
"engine_version": {
6969
Type: schema.TypeString,
7070
Optional: true,
71-
ValidateFunc: validateAllowedStringValue([]string{"5.1", "5.5", "5.6", "5.7"}),
72-
Description: "The version number of the database engine to use. Supported versions include 5.5/5.6/5.7.",
71+
ValidateFunc: validateAllowedStringValue([]string{"5.1", "5.5", "5.6", "5.7", "8.0"}),
72+
Description: "The version number of the database engine to use. Supported versions include 5.5/5.6/5.7/8.0.",
7373
},
7474
"init_flag": {
7575
Type: schema.TypeInt,
@@ -159,7 +159,7 @@ func dataSourceTencentCloudMysqlInstance() *schema.Resource {
159159
"engine_version": {
160160
Type: schema.TypeString,
161161
Computed: true,
162-
Description: "The version number of the database engine to use. Supported versions include 5.5/5.6/5.7.",
162+
Description: "The version number of the database engine to use. Supported versions include 5.5/5.6/5.7/8.0.",
163163
},
164164
"cpu_core_count": {
165165
Type: schema.TypeInt,

tencentcloud/extension_cvm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ const (
4444
CVM_SPOT_INSTANCE_TYPE_ONE_TIME = "ONE-TIME"
4545

4646
CVM_MARKET_TYPE_SPOT = "spot"
47+
48+
CVM_IMAGE_LOGIN = "TRUE"
49+
CVM_IMAGE_LOGIN_NOT = "FALSE"
4750
)
4851

4952
var CVM_CHARGE_TYPE = []string{

tencentcloud/extension_mysql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var MysqlDelStates = map[int64]bool{
7272
//mysql available period value
7373
var MYSQL_AVAILABLE_PERIOD = []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36}
7474

75-
var MYSQL_SUPPORTS_ENGINE = []string{"5.5", "5.6", "5.7"}
75+
var MYSQL_SUPPORTS_ENGINE = []string{"5.5", "5.6", "5.7", "8.0"}
7676

7777
//automatic renewal status code
7878
const (

tencentcloud/resource_tc_clb_listener_rule.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ func resourceTencentCloudClbListenerRule() *schema.Resource {
158158
ValidateFunc: validateAllowedStringValue(CLB_LISTENER_SCHEDULER),
159159
Description: "Scheduling method of the CLB listener rules, and available values are 'WRR', 'IP HASH' and 'LEAST_CONN'. The default is 'WRR'. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in tencentcloud_clb_listener_rule.",
160160
},
161+
"forward_type": {
162+
Type: schema.TypeString,
163+
Optional: true,
164+
Computed: true,
165+
ValidateFunc: validateAllowedStringValue([]string{"HTTP", "HTTPS", "TRPC"}),
166+
Description: "Forwarding protocol between the CLB instance and real server. Currently, HTTP/HTTPS/TRPC are supported.",
167+
},
161168
},
162169
}
163170
}
@@ -204,6 +211,9 @@ func resourceTencentCloudClbListenerRuleCreate(d *schema.ResourceData, meta inte
204211
rule.Domain = helper.String(domain)
205212
url := d.Get("url").(string)
206213
rule.Url = helper.String(url)
214+
if v, ok := d.GetOk("forward_type"); ok {
215+
rule.ForwardType = helper.String(v.(string))
216+
}
207217
scheduler := ""
208218
if v, ok := d.GetOk("scheduler"); ok {
209219
if !(protocol == CLB_LISTENER_PROTOCOL_HTTP || protocol == CLB_LISTENER_PROTOCOL_HTTPS) {
@@ -326,6 +336,7 @@ func resourceTencentCloudClbListenerRuleRead(d *schema.ResourceData, meta interf
326336
_ = d.Set("url", instance.Url)
327337
_ = d.Set("scheduler", instance.Scheduler)
328338
_ = d.Set("session_expire_time", instance.SessionExpireTime)
339+
_ = d.Set("forward_type", instance.ForwardType)
329340

330341
//health check
331342
if instance.HealthCheck != nil {
@@ -397,6 +408,11 @@ func resourceTencentCloudClbListenerRuleUpdate(d *schema.ResourceData, meta inte
397408
request.Url = helper.String(url)
398409
}
399410

411+
if d.HasChange("forward_type") {
412+
changed = true
413+
request.ForwardType = helper.String(d.Get("forward_type").(string))
414+
}
415+
400416
if d.HasChange("scheduler") {
401417
changed = true
402418
scheduler = d.Get("scheduler").(string)
@@ -417,7 +433,6 @@ func resourceTencentCloudClbListenerRuleUpdate(d *schema.ResourceData, meta inte
417433
}
418434
sessionExpireTime64 := int64(sessionExpireTime)
419435
request.SessionExpireTime = &sessionExpireTime64
420-
421436
}
422437

423438
healthSetFlag, healthCheck, healthErr := checkHealthCheckPara(ctx, d, protocol, HEALTH_APPLY_TYPE_RULE)

tencentcloud/resource_tc_clb_listener_rule_test.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ func TestAccTencentCloudClbListenerRule_basic(t *testing.T) {
2727
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "session_expire_time", "30"),
2828
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "url", "/"),
2929
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "scheduler", "WRR"),
30+
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "forward_type", "HTTPS"),
31+
),
32+
},
33+
{
34+
Config: testAccClbListenerRule__basic_update,
35+
Check: resource.ComposeTestCheckFunc(
36+
testAccCheckClbListenerRuleExists("tencentcloud_clb_listener_rule.rule_basic"),
37+
resource.TestCheckResourceAttrSet("tencentcloud_clb_listener_rule.rule_basic", "clb_id"),
38+
resource.TestCheckResourceAttrSet("tencentcloud_clb_listener_rule.rule_basic", "listener_id"),
39+
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "domain", "abc.com"),
40+
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "session_expire_time", "30"),
41+
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "url", "/"),
42+
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "scheduler", "WRR"),
43+
resource.TestCheckResourceAttr("tencentcloud_clb_listener_rule.rule_basic", "forward_type", "HTTP"),
3044
),
3145
},
3246
},
@@ -162,6 +176,31 @@ resource "tencentcloud_clb_listener_rule" "rule_basic" {
162176
url = "/"
163177
session_expire_time = 30
164178
scheduler = "WRR"
179+
forward_type = "HTTPS"
180+
}
181+
`
182+
183+
const testAccClbListenerRule__basic_update = `
184+
resource "tencentcloud_clb_instance" "clb_basic" {
185+
network_type = "OPEN"
186+
clb_name = "tf-clb-rule-basic"
187+
}
188+
189+
resource "tencentcloud_clb_listener" "listener_basic" {
190+
clb_id = tencentcloud_clb_instance.clb_basic.id
191+
port = 1
192+
protocol = "HTTP"
193+
listener_name = "listener_basic"
194+
}
195+
196+
resource "tencentcloud_clb_listener_rule" "rule_basic" {
197+
clb_id = tencentcloud_clb_instance.clb_basic.id
198+
listener_id = tencentcloud_clb_listener.listener_basic.id
199+
domain = "abc.com"
200+
url = "/"
201+
session_expire_time = 30
202+
scheduler = "WRR"
203+
forward_type = "HTTP"
165204
}
166205
`
167206

tencentcloud/resource_tc_instance.go

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -107,51 +107,51 @@ func resourceTencentCloudInstance() *schema.Resource {
107107
Type: schema.TypeString,
108108
Required: true,
109109
ForceNew: true,
110-
Description: "The Image to use for the instance. Change 'image_id' will case instance destroy and re-created.",
110+
Description: "The image to use for the instance. Changing `image_id` will cause the instance to be destroyed and re-created.",
111111
},
112112
"availability_zone": {
113113
Type: schema.TypeString,
114114
Required: true,
115115
ForceNew: true,
116-
Description: "The available zone that the CVM instance locates at.",
116+
Description: "The available zone for the CVM instance.",
117117
},
118118
"instance_name": {
119119
Type: schema.TypeString,
120120
Optional: true,
121121
Default: "Terraform-CVM-Instance",
122122
ValidateFunc: validateStringLengthInRange(2, 128),
123-
Description: "The name of the CVM. The max length of instance_name is 60, and default value is `Terraform-CVM-Instance`.",
123+
Description: "The name of the instance. The max length of instance_name is 60, and default value is `Terraform-CVM-Instance`.",
124124
},
125125
"instance_type": {
126126
Type: schema.TypeString,
127127
Optional: true,
128128
Computed: true,
129129
ValidateFunc: validateInstanceType,
130-
Description: "The type of instance to start.",
130+
Description: "The type of the instance.",
131131
},
132132
"hostname": {
133133
Type: schema.TypeString,
134134
Optional: true,
135135
ForceNew: true,
136-
Description: "The hostname of CVM. Windows instance: The name should be a combination of 2 to 15 characters comprised of letters (case insensitive), numbers, and hyphens (-). Period (.) is not supported, and the name cannot be a string of pure numbers. Other types (such as Linux) of instances: The name should be a combination of 2 to 60 characters, supporting multiple periods (.). The piece between two periods is composed of letters (case insensitive), numbers, and hyphens (-).",
136+
Description: "The hostname of the instance. Windows instance: The name should be a combination of 2 to 15 characters comprised of letters (case insensitive), numbers, and hyphens (-). Period (.) is not supported, and the name cannot be a string of pure numbers. Other types (such as Linux) of instances: The name should be a combination of 2 to 60 characters, supporting multiple periods (.). The piece between two periods is composed of letters (case insensitive), numbers, and hyphens (-).",
137137
},
138138
"project_id": {
139139
Type: schema.TypeInt,
140140
Optional: true,
141141
Default: 0,
142-
Description: "The project CVM belongs to, default to 0.",
142+
Description: "The project the instance belongs to, default to 0.",
143143
},
144144
"running_flag": {
145145
Type: schema.TypeBool,
146146
Optional: true,
147147
Default: true,
148-
Description: "Set instance to running or stop. Default value is true, the instance will shutdown when flag is false.",
148+
Description: "Set instance to running or stop. Default value is true, the instance will shutdown when this flag is false.",
149149
},
150150
"placement_group_id": {
151151
Type: schema.TypeString,
152152
Optional: true,
153153
ForceNew: true,
154-
Description: "The id of a placement group.",
154+
Description: "The ID of a placement group.",
155155
},
156156
// payment
157157
"instance_charge_type": {
@@ -186,7 +186,7 @@ func resourceTencentCloudInstance() *schema.Resource {
186186
Optional: true,
187187
ForceNew: true,
188188
ValidateFunc: validateStringNumber,
189-
Description: "Max price of spot instance, is the format of decimal string, for example \"0.50\". Note: it only works when instance_charge_type is set to `SPOTPAID`.",
189+
Description: "Max price of a spot instance, is the format of decimal string, for example \"0.50\". Note: it only works when instance_charge_type is set to `SPOTPAID`.",
190190
},
191191
// network
192192
"internet_charge_type": {
@@ -201,41 +201,41 @@ func resourceTencentCloudInstance() *schema.Resource {
201201
Type: schema.TypeInt,
202202
Optional: true,
203203
Computed: true,
204-
Description: "Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). This value does not need to be set when `allocate_public_ip` is false.",
204+
Description: "Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bits per second). This value does not need to be set when `allocate_public_ip` is false.",
205205
},
206206
"allocate_public_ip": {
207207
Type: schema.TypeBool,
208208
Optional: true,
209209
Default: false,
210210
ForceNew: true,
211-
Description: "Associate a public ip address with an instance in a VPC or Classic. Boolean value, Default is false.",
211+
Description: "Associate a public IP address with an instance in a VPC or Classic. Boolean value, Default is false.",
212212
},
213213
// vpc
214214
"vpc_id": {
215215
Type: schema.TypeString,
216216
Optional: true,
217217
Computed: true,
218-
Description: "The id of a VPC network. If you want to create instances in VPC network, this parameter must be set.",
218+
Description: "The ID of a VPC network. If you want to create instances in a VPC network, this parameter must be set.",
219219
},
220220
"subnet_id": {
221221
Type: schema.TypeString,
222222
Optional: true,
223223
Computed: true,
224-
Description: "The id of a VPC subnetwork. If you want to create instances in VPC network, this parameter must be set.",
224+
Description: "The ID of a VPC subnet. If you want to create instances in a VPC network, this parameter must be set.",
225225
},
226226
"private_ip": {
227227
Type: schema.TypeString,
228228
Optional: true,
229229
Computed: true,
230-
Description: "The private ip to be assigned to this instance, must be in the provided subnet and available.",
230+
Description: "The private IP to be assigned to this instance, must be in the provided subnet and available.",
231231
},
232232
// security group
233233
"security_groups": {
234234
Type: schema.TypeSet,
235235
Elem: &schema.Schema{Type: schema.TypeString},
236236
Optional: true,
237237
Computed: true,
238-
Description: "A list of security group ids to associate with.",
238+
Description: "A list of security group IDs to associate with.",
239239
},
240240
// storage
241241
"system_disk_type": {
@@ -252,7 +252,7 @@ func resourceTencentCloudInstance() *schema.Resource {
252252
Default: 50,
253253
ForceNew: true,
254254
ValidateFunc: validateIntegerInRange(50, 1000),
255-
Description: "Size of the system disk. Value range: [50, 1000], and unit is GB. Default is 50GB.",
255+
Description: "Size of the system disk. Value range: [50, 1000], and the unit is GB. Default is 50GB.",
256256
},
257257
"system_disk_id": {
258258
Type: schema.TypeString,
@@ -266,7 +266,7 @@ func resourceTencentCloudInstance() *schema.Resource {
266266
Optional: true,
267267
Computed: true,
268268
ForceNew: true,
269-
Description: "Settings for data disk.",
269+
Description: "Settings for data disks.",
270270
Elem: &schema.Resource{
271271
Schema: map[string]*schema.Schema{
272272
"data_disk_type": {
@@ -330,27 +330,35 @@ func resourceTencentCloudInstance() *schema.Resource {
330330
Type: schema.TypeString,
331331
Optional: true,
332332
Computed: true,
333-
Description: "The key pair to use for the instance, it looks like skey-16jig7tx.",
333+
Description: "The key pair to use for the instance, it looks like `skey-16jig7tx`.",
334334
},
335335
"password": {
336336
Type: schema.TypeString,
337337
Optional: true,
338338
Sensitive: true,
339-
Description: "Password to an instance. In order to take effect new password, the instance will be restarted after modifying the password.",
339+
Description: "Password for the instance. In order for the new password to take effect, the instance will be restarted after the password change.",
340+
},
341+
"keep_image_login": {
342+
Type: schema.TypeBool,
343+
Optional: true,
344+
Default: false,
345+
ForceNew: true,
346+
ConflictsWith: []string{"key_name", "password"},
347+
Description: "Whether to keep image login or not, default is `false`. When the image type is private or shared or imported, this parameter can be set `true`.",
340348
},
341349
"user_data": {
342350
Type: schema.TypeString,
343351
Optional: true,
344352
ForceNew: true,
345353
ConflictsWith: []string{"user_data_raw"},
346-
Description: "The user data to be specified into this instance. Must be encrypted in base64 format and limited in 16 KB.",
354+
Description: "The user data to be injected into this instance. Must be base64 encoded and up to 16 KB.",
347355
},
348356
"user_data_raw": {
349357
Type: schema.TypeString,
350358
Optional: true,
351359
ForceNew: true,
352360
ConflictsWith: []string{"user_data"},
353-
Description: "The user data to be specified into this instance, plain text. Conflicts with `user_data`. Limited in 16 KB after encrypted in base64 format.",
361+
Description: "The user data to be injected into this instance, in plain text. Conflicts with `user_data`. Up to 16 KB after base64 encoded.",
354362
},
355363
"tags": {
356364
Type: schema.TypeMap,
@@ -361,7 +369,7 @@ func resourceTencentCloudInstance() *schema.Resource {
361369
Type: schema.TypeBool,
362370
Optional: true,
363371
Default: false,
364-
Description: "Indicate whether to delete instance directly or not. Default is false. If set true, the instance will be permanently deleted instead of staying in recycle bin. Note: only works for `PREPAID` instance.",
372+
Description: "Indicate whether to force delete the instance. Default is false. If set true, the instance will be permanently deleted instead of being moved into the recycle bin. Note: only works for `PREPAID` instance.",
365373
},
366374
// Computed values.
367375
"instance_status": {
@@ -372,7 +380,7 @@ func resourceTencentCloudInstance() *schema.Resource {
372380
"public_ip": {
373381
Type: schema.TypeString,
374382
Computed: true,
375-
Description: "Public ip of the instance.",
383+
Description: "Public IP of the instance.",
376384
},
377385
"create_time": {
378386
Type: schema.TypeString,
@@ -554,6 +562,12 @@ func resourceTencentCloudInstanceCreate(d *schema.ResourceData, meta interface{}
554562
if v, ok := d.GetOk("password"); ok {
555563
request.LoginSettings.Password = helper.String(v.(string))
556564
}
565+
v := d.Get("keep_image_login").(bool)
566+
if v {
567+
request.LoginSettings.KeepImageLogin = helper.String(CVM_IMAGE_LOGIN)
568+
} else {
569+
request.LoginSettings.KeepImageLogin = helper.String(CVM_IMAGE_LOGIN_NOT)
570+
}
557571

558572
if v, ok := d.GetOk("user_data"); ok {
559573
request.UserData = helper.String(v.(string))
@@ -778,6 +792,9 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{})
778792
} else {
779793
_ = d.Set("key_name", "")
780794
}
795+
if instance.LoginSettings.KeepImageLogin != nil {
796+
_ = d.Set("keep_image_login", *instance.LoginSettings.KeepImageLogin == CVM_IMAGE_LOGIN)
797+
}
781798
if *instance.InstanceState == CVM_STATUS_STOPPED {
782799
_ = d.Set("running_flag", false)
783800
} else {

0 commit comments

Comments
 (0)