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

Tencentcloud_clb_target_group_instance_attachment create resource failed on v1.18.110 #2736

Open troyqu opened 1 month ago

troyqu commented 1 month ago

Community Note

Terraform Version

āžœ  03-instance git:(feat) āœ— tf -version             
Terraform v1.8.4
on darwin_amd64
+ provider registry.terraform.io/tencentcloudstack/tencentcloud v1.81.110

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
āžœ  03-instance git:(feat) āœ— 

Affected Resource(s)

Terraform Configuration Files

tencentcloud_clb_target_group_instance_attachment resource hcl

resource "tencentcloud_clb_target_group_instance_attachment" "items" {
  #Required
  bind_ip = try(local.depend_resource[var.configData.bind_ip], var.configData.bind_ip)
  port = try(local.depend_resource[var.configData.port], var.configData.port)
  target_group_id = try(local.depend_resource[var.configData.target_group_id], var.configData.target_group_id)
  weight = var.configData.weight
}

below are the output of resource creating

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_instance["LB-xxx-website"].tencentcloud_clb_instance.items will be created
  + resource "tencentcloud_clb_instance" "items" {
      + address_ip_version           = (known after apply)
      + address_ipv6                 = (known after apply)
      + clb_name                     = "LB-xxx-website"
      + clb_vips                     = (known after apply)
      + delete_protect               = false
      + domain                       = (known after apply)
      + id                           = (known after apply)
      + internet_bandwidth_max_out   = 10
      + internet_charge_type         = "TRAFFIC_POSTPAID_BY_HOUR"
      + ipv6_mode                    = (known after apply)
      + load_balancer_pass_to_target = false
      + master_zone_id               = (known after apply)
      + network_type                 = "OPEN"
      + project_id                   = 0
      + sla_type                     = (known after apply)
      + slave_zone_id                = (known after apply)
      + tags                         = {
          + "env"         = "prod"
        }
      + target_region_info_region    = (known after apply)
      + target_region_info_vpc_id    = (known after apply)
      + vip                          = (known after apply)
      + vip_isp                      = (known after apply)
      + vpc_id                       = "vpc-ia7khsuc"
      + zone_id                      = (known after apply)
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_listener["LB-LSNR-www.xxx.com-443"].tencentcloud_clb_listener.items will be created
  + resource "tencentcloud_clb_listener" "items" {
      + clb_id                     = (known after apply)
      + end_port                   = (known after apply)
      + health_check_context_type  = (known after apply)
      + health_check_health_num    = 3
      + health_check_http_method   = (known after apply)
      + health_check_interval_time = 5
      + health_check_port          = 443
      + health_check_switch        = true
      + health_check_time_out      = 2
      + health_check_type          = "TCP"
      + health_check_unhealth_num  = 3
      + health_source_ip_type      = 1
      + id                         = (known after apply)
      + keepalive_enable           = (known after apply)
      + listener_id                = (known after apply)
      + listener_name              = "LB-LSNR-www.xxx.com-443"
      + port                       = 443
      + protocol                   = "TCP"
      + scheduler                  = "WRR"
      + session_type               = (known after apply)
      + target_type                = "NODE"
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_listener["LB-LSNR-www.xxx.com-80"].tencentcloud_clb_listener.items will be created
  + resource "tencentcloud_clb_listener" "items" {
      + clb_id                     = (known after apply)
      + end_port                   = (known after apply)
      + health_check_context_type  = (known after apply)
      + health_check_health_num    = 3
      + health_check_http_method   = (known after apply)
      + health_check_interval_time = 5
      + health_check_port          = 80
      + health_check_switch        = true
      + health_check_time_out      = 2
      + health_check_type          = "TCP"
      + health_check_unhealth_num  = 3
      + health_source_ip_type      = 1
      + id                         = (known after apply)
      + keepalive_enable           = (known after apply)
      + listener_id                = (known after apply)
      + listener_name              = "LB-LSNR-www.xxx.com-80"
      + port                       = 80
      + protocol                   = "TCP"
      + scheduler                  = "WRR"
      + session_type               = (known after apply)
      + target_type                = "NODE"
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group["LB-TG-www.xxx.com-443"].tencentcloud_clb_target_group.items will be created
  + resource "tencentcloud_clb_target_group" "items" {
      + id                = (known after apply)
      + port              = 443
      + target_group_name = "LB-TG-www.xxx.com-443"
      + vpc_id            = "vpc-ia7khsuc"
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group["LB-TG-www.xxx.com-80"].tencentcloud_clb_target_group.items will be created
  + resource "tencentcloud_clb_target_group" "items" {
      + id                = (known after apply)
      + port              = 80
      + target_group_name = "LB-TG-www.xxx.com-80"
      + vpc_id            = "vpc-ia7khsuc"
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group_attachment["LB-TGA-www.xxx.com-443"].tencentcloud_clb_target_group_attachment.items will be created
  + resource "tencentcloud_clb_target_group_attachment" "items" {
      + clb_id          = (known after apply)
      + id              = (known after apply)
      + listener_id     = (known after apply)
      + target_group_id = (known after apply)
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group_attachment["LB-TGA-www.xxx.com-80"].tencentcloud_clb_target_group_attachment.items will be created
  + resource "tencentcloud_clb_target_group_attachment" "items" {
      + clb_id          = (known after apply)
      + id              = (known after apply)
      + listener_id     = (known after apply)
      + target_group_id = (known after apply)
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group_instance_attachment["LB-TGIA-www.xxx.com-443"].tencentcloud_clb_target_group_instance_attachment.items will be created
  + resource "tencentcloud_clb_target_group_instance_attachment" "items" {
      + bind_ip         = "192.168.50.9"
      + id              = (known after apply)
      + port            = 443
      + target_group_id = (known after apply)
      + weight          = 10
    }

  # module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group_instance_attachment["LB-TGIA-www.xxx.com-80"].tencentcloud_clb_target_group_instance_attachment.items will be created
  + resource "tencentcloud_clb_target_group_instance_attachment" "items" {
      + bind_ip         = "192.168.50.9"
      + id              = (known after apply)
      + port            = 80
      + target_group_id = (known after apply)
      + weight          = 10
    }

Plan: 9 to add, 0 to change, 0 to destroy.

Debug Output

Panic Output

module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group_instance_attachment["LB-TGIA-www.xxx.com-443"].tencentcloud_clb_target_group_instance_attachment.items: Creation complete after 5s [id=lbtg-js4riq1x#192.168.50.9#443]
ā•·
ā”‚ Error: [TencentCloudSDKError] Code=FailedOperation, Message=listenerId lbl-qizodntv not in targetgroup mode, RequestId=83d90d8c-5754-479e-87a2-6588e0be1880
ā”‚ 
ā”‚   with module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group_attachment["LB-TGA-www.xxx.com-80"].tencentcloud_clb_target_group_attachment.items,
ā”‚   on ../../../../../../terraform.cloudbase.modules/tencentcloud/tencentcloud_clb_target_group_attachment/main.tf line 30, in resource "tencentcloud_clb_target_group_attachment" "items":
ā”‚   30: resource "tencentcloud_clb_target_group_attachment" "items" {
ā”‚ 
ā•µ
ā•·
ā”‚ Error: [TencentCloudSDKError] Code=FailedOperation, Message=listenerId lbl-ranbpxpp not in targetgroup mode, RequestId=fb0e14a6-8970-4542-9590-e0b71bea717a
ā”‚ 
ā”‚   with module.tencentcloud_clb_instance.module.tencentcloud_clb_target_group_attachment["LB-TGA-www.xxx.com-443"].tencentcloud_clb_target_group_attachment.items,
ā”‚   on ../../../../../../terraform.cloudbase.modules/tencentcloud/tencentcloud_clb_target_group_attachment/main.tf line 30, in resource "tencentcloud_clb_target_group_attachment" "items":
ā”‚   30: resource "tencentcloud_clb_target_group_attachment" "items" {
ā”‚ 

Expected Behavior

  1. lb resource created successfully
  2. no error output on console
  3. backend server is successfully bound to the load balancer

Actual Behavior

  1. lb resource created successfully
  2. error output on console
  3. backend server is not bound to the load balancer

Steps to Reproduce

  1. terraform apply

Important Factoids

References

https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/clb_target_group_instance_attachment