terraform-provider-tencentcloud icon indicating copy to clipboard operation
terraform-provider-tencentcloud copied to clipboard

For tencentcloud_clb_listener_rule domain can't be regular expression or wildcards even though such config can be added on Tencen console manually

Open andre1704 opened this issue 8 months ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

terraform -v
Terraform v1.11.1 on linux_amd64

  • provider registry.terraform.io/tencentcloudstack/tencentcloud v1.81.181

Affected Resource(s)

  • tencentcloud_clb_listener_rule

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

resource "tencentcloud_clb_instance" "public" {
  clb_name                     = "test-123"
  network_type                 = "OPEN"
  vpc_id                       = var.cloud_vpc_id
  snat_pro                     = true
  load_balancer_pass_to_target = true
  snat_ips {
    subnet_id = var.cloud_subnet_id
  }

}

resource "tencentcloud_clb_listener" "https" {
  clb_id               = tencentcloud_clb_instance.public.id
  listener_name        = join("-", ["https", var.pub_subdomain])
  protocol             = "HTTPS"
  port                 = 443
  certificate_id       = var.ssl_id
  certificate_ssl_mode = "UNIDIRECTIONAL"
}

resource "tencentcloud_clb_listener_rule" "https_rule" {
  listener_id          = tencentcloud_clb_listener.https.listener_id
  clb_id               = tencentcloud_clb_instance.public.id
  domain               = join(".", ["*", var.pub_domain])
  url                  = "/"
  certificate_ssl_mode = "UNIDIRECTIONAL"
  certificate_id       = var.ssl_id
  target_type          = "NODE"
  health_check_type    = "TCP"
}


Debug Output

Panic Output

Expected Behavior

CLB rules are added to the created CLB

Actual Behavior

I am getting an error that the wildcard can't be used

"Error: [TencentCloudSDKError] Code=InvalidParameterValue, Message=HttpCheckDomain:*.example.io can't be regular expression or wildcards."

If I add such a CLB rule manually on the Tencent console with a wildcard, it works, but when I try to do it from the terraform code, it does not work.

Steps to Reproduce

  1. terraform apply with config:
resource "tencentcloud_clb_listener_rule" "https_rule" {
  listener_id          = tencentcloud_clb_listener.https.listener_id
  clb_id               = tencentcloud_clb_instance.public.id
  domain               = join(".", ["*", var.pub_domain])

You will get an error Code=InvalidParameterValue, Message=HttpCheckDomain:*.example.io can't be regular expression or wildcards.

Here is a workaround to the bug: 2. terraform apply with different config

resource "tencentcloud_clb_listener_rule" "https_rule" {
  listener_id          = tencentcloud_clb_listener.https.listener_id
  clb_id               = tencentcloud_clb_instance.public.id
  domain               = var.pub_domain

After this listener_rule will be applied once again do terraform apply with different settings

resource "tencentcloud_clb_listener_rule" "https_rule" {
  listener_id          = tencentcloud_clb_listener.https.listener_id
  clb_id               = tencentcloud_clb_instance.public.id
  domain               = join(".", ["*", var.pub_domain])

Important Factoids

References

  • #0000

andre1704 avatar Apr 09 '25 15:04 andre1704