Skip to content

Commit ce89370

Browse files
committed
fix:labels nil
1 parent 51ef709 commit ce89370

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

tencentcloud/services/tke/resource_tc_kubernetes_cluster_attachment_extension.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func resourceTencentCloudKubernetesClusterAttachmentCreatePostFillRequest0(ctx c
4242
}
4343

4444
// labels
45+
req.InstanceAdvancedSettings = &tke.InstanceAdvancedSettings{}
4546
req.InstanceAdvancedSettings.Labels = GetTkeLabels(d, "labels")
4647

4748
if dMap, ok := helper.InterfacesHeadMap(d, "worker_config"); ok {

tencentcloud/services/tke/resource_tc_kubernetes_cluster_attachment_test.go

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,33 +154,46 @@ locals {
154154

155155
func testAccTkeAttachCluster() string {
156156

157-
return tcacctest.TkeDataSource + ClusterAttachmentInstanceType + tcacctest.DefaultImages + `
157+
return TkeNewDeps + `
158158
variable "cluster_cidr" {
159-
default = "172.16.0.0/16"
159+
default = "10.31.0.0/16"
160+
}
161+
162+
variable "availability_zone" {
163+
default = "ap-guangzhou-3"
160164
}
161165
162166
data "tencentcloud_vpc_instances" "vpcs" {
163167
name = "keep_tke_exclusive_vpc"
164168
}
165169
166-
data "tencentcloud_vpc_subnets" "sub" {
167-
vpc_id = data.tencentcloud_vpc_instances.vpcs.instance_list.0.vpc_id
170+
resource "tencentcloud_kubernetes_cluster" "example" {
171+
vpc_id = local.vpc_id
172+
cluster_cidr = var.cluster_cidr
173+
cluster_max_pod_num = 32
174+
cluster_name = "tf_example_cluster"
175+
cluster_desc = "example for tke cluster"
176+
cluster_max_service_num = 32
177+
cluster_internet = false # (can be ignored) open it after the nodes added
178+
cluster_version = "1.22.5"
179+
cluster_os = "tlinux2.2(tkernel3)x86_64"
180+
cluster_deploy_type = "MANAGED_CLUSTER"
181+
# without any worker config
168182
}
169183
170184
resource "tencentcloud_instance" "foo_attachment" {
171185
instance_name = "tf-auto-test-1-1"
172-
availability_zone = data.tencentcloud_vpc_subnets.sub.instance_list.0.availability_zone
186+
availability_zone = var.availability_zone
173187
image_id = var.default_img_id
174-
instance_type = local.type1
188+
instance_type = local.final_type
175189
system_disk_type = "CLOUD_PREMIUM"
176190
system_disk_size = 50
177-
vpc_id = data.tencentcloud_vpc_instances.vpcs.instance_list.0.vpc_id
178-
subnet_id = data.tencentcloud_vpc_subnets.sub.instance_list.0.subnet_id
179-
tags = data.tencentcloud_kubernetes_clusters.tke.list.0.tags # new added node will passive add tag by cluster
191+
vpc_id = local.vpc_id
192+
subnet_id = local.subnet_id1
180193
}
181194
182195
resource "tencentcloud_kubernetes_cluster_attachment" "test_attach" {
183-
cluster_id = local.cluster_id
196+
cluster_id = tencentcloud_kubernetes_cluster.example.id
184197
instance_id = tencentcloud_instance.foo_attachment.id
185198
password = "Lo4wbdit"
186199
unschedulable = 0

0 commit comments

Comments
 (0)