Skip to content

Commit 808c9be

Browse files
authored
fix: tke - nodepool and endpoint security group (#1296)
1 parent 7915ab6 commit 808c9be

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

tencentcloud/resource_tc_kubernetes_cluster_endpoint_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ func TestAccTencentCloudTkeClusterEndpoint(t *testing.T) {
6363
}
6464

6565
const testAccTkeClusterEndpointNewSG = `
66-
resource "tencentcloud_security_group" "foo" {
66+
resource "tencentcloud_security_group" "new_sg" {
6767
name = "test-endpoint"
6868
}
6969
70-
resource "tencentcloud_security_group_lite_rule" "foo" {
71-
security_group_id = tencentcloud_security_group.foo.id
70+
resource "tencentcloud_security_group_lite_rule" "new_sg" {
71+
security_group_id = tencentcloud_security_group.new_sg.id
7272
7373
ingress = [
7474
"DROP#0.0.0.0/16#ALL#ALL",
7575
]
7676
}
7777
7878
locals {
79-
new_sg = tencentcloud_security_group_lite_rule.foo.id
79+
new_sg = tencentcloud_security_group.new_sg.id
8080
}
8181
8282
`

tencentcloud/resource_tc_kubernetes_node_pool_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"log"
7+
"regexp"
78
"strings"
89
"testing"
910

@@ -26,6 +27,8 @@ func init() {
2627
})
2728
}
2829

30+
var nodePoolNameReg = regexp.MustCompile("^(mynodepool|np)")
31+
2932
func testNodePoolSweep(region string) error {
3033
logId := getLogId(contextNil)
3134
ctx := context.WithValue(context.TODO(), logIdKey, logId)
@@ -50,7 +53,11 @@ func testNodePoolSweep(region string) error {
5053
for i := range nodePools {
5154
poolId := *nodePools[i].NodePoolId
5255
poolName := nodePools[i].Name
53-
if poolName == nil || (*poolName != "mynodepool" && *poolName != "mynodepoolupdate") {
56+
if poolName == nil {
57+
continue
58+
}
59+
60+
if !nodePoolNameReg.MatchString(*poolName) {
5461
continue
5562
}
5663
err := service.DeleteClusterNodePool(ctx, defaultTkeClusterId, poolId, false)

0 commit comments

Comments
 (0)