Skip to content

Commit fe78679

Browse files
authored
Merge pull request #535 from gailwang/master
fix CLB force new bug and document issues
2 parents 2b93c93 + db40154 commit fe78679

9 files changed

+25
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## 1.45.3 (Unreleased)
22

33
BUG FIXES:
4+
* Resource: `tencentcloud_clb_instance` fix force new when updating tags.
5+
* Resource: `tencentcloud_redis_backup_config` fix doc issues.
6+
* Resource: `tencentcloud_instance` fix `keep_image_login` force new issue when updating terraform version.
47
* Resource: `tencentcloud_clb_instance` fix tag creation bug.
58

69
## 1.45.2 (October 19, 2020)

tencentcloud/resource_tc_clb_instance.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ func resourceTencentCloudClbInstance() *schema.Resource {
134134
"tags": {
135135
Type: schema.TypeMap,
136136
Optional: true,
137-
ForceNew: true,
138137
Description: "The available tags within this CLB.",
139138
},
140139
},

tencentcloud/resource_tc_clb_instance_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func TestAccTencentCloudClbInstance_open(t *testing.T) {
5353
resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.clb_open", "security_groups.0"),
5454
resource.TestCheckResourceAttr("tencentcloud_clb_instance.clb_open", "target_region_info_region", "ap-guangzhou"),
5555
resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.clb_open", "target_region_info_vpc_id"),
56+
resource.TestCheckResourceAttr("tencentcloud_clb_instance.clb_open", "tags.test", "tf"),
5657
),
5758
},
5859
{
@@ -67,6 +68,7 @@ func TestAccTencentCloudClbInstance_open(t *testing.T) {
6768
resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.clb_open", "security_groups.0"),
6869
resource.TestCheckResourceAttr("tencentcloud_clb_instance.clb_open", "target_region_info_region", "ap-guangzhou"),
6970
resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.clb_open", "target_region_info_vpc_id"),
71+
resource.TestCheckResourceAttr("tencentcloud_clb_instance.clb_open", "tags.test", "test"),
7072
),
7173
},
7274
},
@@ -102,6 +104,7 @@ func TestAccTencentCloudClbInstance_internal(t *testing.T) {
102104
resource.TestCheckResourceAttr("tencentcloud_clb_instance.clb_internal", "project_id", "0"),
103105
resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.clb_internal", "vpc_id"),
104106
resource.TestCheckResourceAttrSet("tencentcloud_clb_instance.clb_internal", "subnet_id"),
107+
resource.TestCheckResourceAttr("tencentcloud_clb_instance.clb_internal", "tags.test", "test"),
105108
),
106109
},
107110
{
@@ -248,7 +251,7 @@ resource "tencentcloud_clb_instance" "clb_internal" {
248251
project_id = 0
249252
250253
tags = {
251-
test = "tf1"
254+
test = "test"
252255
}
253256
}
254257
`
@@ -273,7 +276,7 @@ resource "tencentcloud_clb_instance" "clb_open" {
273276
security_groups = [tencentcloud_security_group.foo.id]
274277
275278
tags = {
276-
test = "tf"
279+
test = "test"
277280
}
278281
}
279282
`

tencentcloud/resource_tc_instance.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,16 @@ func resourceTencentCloudInstance() *schema.Resource {
339339
Description: "Password for the instance. In order for the new password to take effect, the instance will be restarted after the password change.",
340340
},
341341
"keep_image_login": {
342-
Type: schema.TypeBool,
343-
Optional: true,
344-
Default: false,
342+
Type: schema.TypeBool,
343+
Optional: true,
344+
Default: false,
345+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
346+
if new == "false" && old == "" || old == "false" && new == "" {
347+
return true
348+
} else {
349+
return old == new
350+
}
351+
},
345352
ForceNew: true,
346353
ConflictsWith: []string{"key_name", "password"},
347354
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`.",
@@ -795,6 +802,7 @@ func resourceTencentCloudInstanceRead(d *schema.ResourceData, meta interface{})
795802
if instance.LoginSettings.KeepImageLogin != nil {
796803
_ = d.Set("keep_image_login", *instance.LoginSettings.KeepImageLogin == CVM_IMAGE_LOGIN)
797804
}
805+
798806
if *instance.InstanceState == CVM_STATUS_STOPPED {
799807
_ = d.Set("running_flag", false)
800808
} else {

tencentcloud/resource_tc_redis_backup_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Use this data source to query which instance types of Redis are available in a specific region.
2+
Use this resource to create a backup config of redis.
33
44
Example Usage
55

tencentcloud/resource_tc_redis_instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func resourceTencentCloudRedisInstance() *schema.Resource {
7979
Optional: true,
8080
ForceNew: true,
8181
ValidateFunc: validateIntegerMin(2),
82-
Description: "Instance type. Refer to `data.tencentcloud_redis_zone_config.list.type_id` get available values.",
82+
Description: "Instance type. Available values reference data source `tencentcloud_redis_zone_config` or [document](https://intl.cloud.tencent.com/document/product/239/32069).",
8383
},
8484
"redis_shard_num": {
8585
Type: schema.TypeInt,

website/docs/r/clb_instance.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The following arguments are supported:
5656
* `project_id` - (Optional, ForceNew) Id of the project within the CLB instance, '0' - Default Project.
5757
* `security_groups` - (Optional) Security groups of the CLB instance. Only supports 'OPEN' CLBs.
5858
* `subnet_id` - (Optional, ForceNew) Subnet id of the CLB. Effective only for CLB within the VPC. Only supports 'INTERNAL' CLBs.
59-
* `tags` - (Optional, ForceNew) The available tags within this CLB.
59+
* `tags` - (Optional) The available tags within this CLB.
6060
* `target_region_info_region` - (Optional) Region information of backend services are attached the CLB instance. Only supports 'OPEN' CLBs.
6161
* `target_region_info_vpc_id` - (Optional) Vpc information of backend services are attached the CLB instance. Only supports 'OPEN' CLBs.
6262
* `vpc_id` - (Optional, ForceNew) VPC id of the CLB.

website/docs/r/redis_backup_config.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ layout: "tencentcloud"
44
page_title: "TencentCloud: tencentcloud_redis_backup_config"
55
sidebar_current: "docs-tencentcloud-resource-redis_backup_config"
66
description: |-
7-
Use this data source to query which instance types of Redis are available in a specific region.
7+
Use this resource to create a backup config of redis.
88
---
99

1010
# tencentcloud_redis_backup_config
1111

12-
Use this data source to query which instance types of Redis are available in a specific region.
12+
Use this resource to create a backup config of redis.
1313

1414
## Example Usage
1515

website/docs/r/redis_instance.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The following arguments are supported:
4747
* `security_groups` - (Optional, ForceNew) ID of security group. If both vpc_id and subnet_id are not set, this argument should not be set either.
4848
* `subnet_id` - (Optional, ForceNew) Specifies which subnet the instance should belong to.
4949
* `tags` - (Optional) Instance tags.
50-
* `type_id` - (Optional, ForceNew) Instance type. Refer to `data.tencentcloud_redis_zone_config.list.type_id` get available values.
50+
* `type_id` - (Optional, ForceNew) Instance type. Available values reference data source `tencentcloud_redis_zone_config` or [document](https://intl.cloud.tencent.com/document/product/239/32069).
5151
* `type` - (Optional, ForceNew, **Deprecated**) It has been deprecated from version 1.33.1. Please use 'type_id' instead. Instance type. Available values: `cluster_ckv`,`cluster_redis5.0`,`cluster_redis`,`master_slave_ckv`,`master_slave_redis5.0`,`master_slave_redis`,`standalone_redis`, specific region support specific types, need to refer data `tencentcloud_redis_zone_config`.
5252
* `vpc_id` - (Optional, ForceNew) ID of the vpc with which the instance is to be associated.
5353

0 commit comments

Comments
 (0)