tencentcloudstack / terraform-provider-tencentcloud

Terraform Tencent Cloud Provider
https://www.terraform.io/docs/providers/tencentcloud/
Mozilla Public License 2.0
189 stars 132 forks source link

v1.18.108 tencentcloud_kubernetes_scale_worker created resource failed when count > 1 #2726

Open troyqu opened 1 month ago

troyqu commented 1 month ago

Community Note

Terraform Version

➜  anchnet-terraform-framwork-demo git:(feature_smartops) ✗ tf -v      
Terraform v1.8.4
on darwin_amd64

Your version of Terraform is out of date! The latest version
is 1.9.2. You can update by downloading from https://www.terraform.io/downloads.html
➜  anchnet-terraform-framwork-demo git:(feature_smartops) ✗ 

Affected Resource(s)

Terraform Configuration Files

resource "tencentcloud_kubernetes_scale_worker" "items" {

  # required regular vars
  cluster_id = try(local.depend_resource[var.configData.cluster_id], var.configData.cluster_id)

  worker_config {
      count = var.configData.worker_config.count
      instance_type = var.configData.worker_config.instance_type
      subnet_id = try(local.depend_resource[var.configData.worker_config.subnet_id], var.configData.worker_config.subnet_id)
      availability_zone = var.configData.worker_config.availability_zone
      hostname = var.configData.worker_config.hostname
      img_id = var.configData.worker_config.img_id
      instance_charge_type = var.configData.worker_config.instance_charge_type
      instance_charge_type_prepaid_period = var.configData.worker_config.instance_charge_type_prepaid_period
      instance_charge_type_prepaid_renew_flag = var.configData.worker_config.instance_charge_type_prepaid_renew_flag
      instance_name = var.configData.worker_config.instance_name
      password = var.configData.worker_config.password
      security_group_ids = flatten([for k in var.configData.worker_config.security_group_ids : flatten([try(local.depend_resource[k], k)])])
      system_disk_size = var.configData.worker_config.system_disk_size
      system_disk_type = var.configData.worker_config.system_disk_type
  }
}

Debug Output

below are the output by plan & apply ⌘

terraform plan output: https://gist.github.com/troyqu/5f5312a1db7bd31d752e98c1d60c5b82 terraform apply output: https://gist.github.com/troyqu/977cafb44dc58f8b392bf3716193f15d

Panic Output

╷
│ Error: id is broken,cls-dpvb27uh#ins-gkvsm6ud#ins-7la52daf#ins-rjbve37x
│ 
│   with module.tencentcloud_kubernetes_cluster.module.tencentcloud_kubernetes_scale_worker["TKE-SW-1-TKE-SmartOps"].tencentcloud_kubernetes_scale_worker.items,
│   on ../../../../../../terraform.cloudbase.modules/tencentcloud/tencentcloud_kubernetes_scale_worker/main.tf line 34, in resource "tencentcloud_kubernetes_scale_worker" "items":
│   34: resource "tencentcloud_kubernetes_scale_worker" "items" {
│ 
╵
➜  

Expected Behavior

1.resource created success,no error in console output 2.resource can destroy by terraform destroy

Actual Behavior

1.resource created success,console output error 2.resource can not destroy by terraform destroy

Steps to Reproduce

  1. terraform apply

Important Factoids

1.after i tried such times on my local, i found if the count > 1 then the error will be hit. if count=1, then everything is fine. 2.i also checked the id in state file, the id field same as the output. id is "cls-dpvb27uh#ins-gkvsm6ud#ins-7la52daf#ins-rjbve37x" image

References

https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/1.81.107/docs/resources/kubernetes_scale_worker#example-usage