This SLB rule loop is part of a larger load balancer module I'm currently working on containing configs required to deploy my company's application. I can provide more of the code if needed - it seems like the issue might be around some of the specific settings here (more on that in the Actual Behaviour section below) .
resource "alicloud_slb_rule" "rule" {
for_each = {
for mapping in local.mappings : format("%s:%s", mapping.name, mapping.path) => mapping if mapping.settings.create_group
}
load_balancer_id = alicloud_slb.lb.id
frontend_port = alicloud_slb_listener.https.frontend_port
name = "${var.environment}-${var.name}-${replace(each.key, ":", "-")}" # terraform resource mappings look better with ':' but it's not an allowed character for rule names
url = each.value.path
server_group_id = alicloud_slb_server_group.group[each.value.name].id
health_check = "on"
listener_sync = "off" # override default healthcheck with service one
health_check_http_code = "http_2xx"
health_check_interval = 10
health_check_uri = each.value.settings.health_check_path
health_check_connect_port = each.value.settings.health_check_port
health_check_timeout = 10
healthy_threshold = 3
unhealthy_threshold = 5
sticky_session = each.value.settings.stickiness ? "on" : "off"
sticky_session_type = "server"
cookie = "SESSION"
}
Debug Output
Can provide if required.
Expected Behaviour
All load balancer rules created.
Actual Behaviour
When executing terraform apply some (but not all!) of the rules generated using the loop above throw this error:
Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_slb_rule.go:350: Resource rule-7go0y2w91ejzn SetRule Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
SDK.ServerError
ErrorCode: OperationFailed.ListenerStatusNotSupport
Recommend: https://error-center.aliyun.com/status/search?Keyword=OperationFailed.ListenerStatusNotSupport&source=PopGw
RequestId: 8C4931E6-E179-4FA1-A68A-A04C4C96C107
Message: The status of the listener does not support this operation. Please try again later.
When applying terraform again, terraform detects that the rules have indeed been created but with incorrect settings - all the advanced features are missing:
This is confirmed in the UI:
Note the missing (i) icon next to some of the rules - they should all have one.
Applying the terraform plan again results in some of these being fixed - eventually all are applied correctly (it usually takes me 3-5 attempts to get all 17 rules listed here configured correctly).
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
Terraform Version
Terraform v0.14.5
Affected Resource(s)
Terraform Configuration Files
This SLB rule loop is part of a larger load balancer module I'm currently working on containing configs required to deploy my company's application. I can provide more of the code if needed - it seems like the issue might be around some of the specific settings here (more on that in the Actual Behaviour section below) .
Debug Output
Can provide if required.
Expected Behaviour
All load balancer rules created.
Actual Behaviour
When executing
terraform apply
some (but not all!) of the rules generated using the loop above throw this error:When applying terraform again, terraform detects that the rules have indeed been created but with incorrect settings - all the advanced features are missing:
This is confirmed in the UI: Note the missing (i) icon next to some of the rules - they should all have one. Applying the terraform plan again results in some of these being fixed - eventually all are applied correctly (it usually takes me 3-5 attempts to get all 17 rules listed here configured correctly).
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply