Skip to content

Commit 7f5fc0c

Browse files
authored
fix: tke testcase - instance type ref (#1065)
1 parent 6ff885a commit 7f5fc0c

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

tencentcloud/basic_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,15 +631,15 @@ variable "tke_cidr_c" {
631631
const TkeInstanceType = `
632632
data "tencentcloud_instance_types" "ins_type" {
633633
availability_zone = "` + defaultCvmAZone + `"
634-
cpu_core_count = 1
635-
memory_size = 2
634+
cpu_core_count = 2
636635
exclude_sold_out = true
637636
}
638637
639638
locals {
640639
ins_az = "` + defaultCvmAZone + `"
641-
type1 = [for i in data.tencentcloud_instance_types.ins_type.instance_types: i if lookup(i, "instance_charge_type") == "POSTPAID_BY_HOUR"][0].instance_type
642-
type2 = [for i in data.tencentcloud_instance_types.ins_type.instance_types: i if lookup(i, "instance_charge_type") == "POSTPAID_BY_HOUR"][1].instance_type
640+
type1 = [for i in data.tencentcloud_instance_types.ins_type.instance_types: i if lookup(i, "instance_charge_type") == "POSTPAID_BY_HOUR"]
641+
type2 = [for i in data.tencentcloud_instance_types.ins_type.instance_types: i]
642+
final_type = concat(local.type1, local.type2)[0].instance_type
643643
}
644644
`
645645

tencentcloud/resource_tc_kubernetes_cluster_test.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,6 @@ func testAccCheckTkeExists(n string) resource.TestCheckFunc {
218218
}
219219
}
220220

221-
// If test environment change, make sure to attach Tke access cls permission
222-
// We will not apply/destroy frequently
223-
const TkeAccessClsRole = `
224-
data "tencentcloud_cam_roles" "tke" {
225-
name = "TKE_QCSRole"
226-
}
227-
228-
data "tencentcloud_cam_policies" "cls" {
229-
name = "QcloudCLSFullAccess"
230-
}
231-
232-
resource "tencentcloud_cam_role_policy_attachment" "tke_cls" {
233-
policy_id = data.tencentcloud_cam_policies.cls.policy_list.0.policy_id
234-
role_id = data.tencentcloud_cam_roles.tke.role_list.0.role_id
235-
}
236-
`
237-
238221
const TkeDeps = TkeExclusiveNetwork + TkeInstanceType + TkeCIDRs + defaultImages + defaultSecurityGroupData
239222

240223
const testAccTkeCluster = TkeDeps + `
@@ -258,7 +241,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
258241
worker_config {
259242
count = 1
260243
availability_zone = var.availability_zone
261-
instance_type = local.type1
244+
instance_type = local.final_type
262245
system_disk_type = "CLOUD_SSD"
263246
system_disk_size = 60
264247
internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR"
@@ -321,7 +304,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
321304
worker_config {
322305
count = 1
323306
availability_zone = var.availability_zone
324-
instance_type = local.type1
307+
instance_type = local.final_type
325308
system_disk_type = "CLOUD_SSD"
326309
system_disk_size = 60
327310
internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR"

tencentcloud/resource_tc_kubernetes_node_pool_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ resource "tencentcloud_kubernetes_node_pool" "np_test" {
234234
scaling_group_project_id = "` + defaultProjectId + `"
235235
236236
auto_scaling_config {
237-
instance_type = local.type1
237+
instance_type = local.final_type
238238
system_disk_type = "CLOUD_PREMIUM"
239239
system_disk_size = "50"
240240
security_group_ids = [data.tencentcloud_security_groups.sg.security_groups[0].security_group_id]
@@ -292,7 +292,7 @@ resource "tencentcloud_kubernetes_node_pool" "np_test" {
292292
termination_policies = ["NEWEST_INSTANCE"]
293293
294294
auto_scaling_config {
295-
instance_type = local.type1
295+
instance_type = local.final_type
296296
system_disk_type = "CLOUD_PREMIUM"
297297
system_disk_size = "100"
298298
security_group_ids = [data.tencentcloud_security_groups.sg.security_groups[0].security_group_id]

0 commit comments

Comments
 (0)