(ElasticLoadBalancingV2): CDK to automatically calculate priority for host-based load balancer rules
See original GitHub issueUse Case
When creating a host-based load balancer rule, I really don’t care about the rule priority because I rely on exact matches, so I don’t want to have to keep track of the priority values and make sure I don’t try to set the same value twice or else I’ll get an error on deployment. I realize this is a problem with AWS itself (it should really be fixed there so no one would have to do anything custom like today), but other tools like Terraform have solved this problem internally so that the end user doesn’t have to care about it. It would be great if CDK did this by default as well, and the user would provide the value if there’s an exception to the rule.
Desired behavior:
When creating a load balancer rule like this:
ApplicationListenerRule.Builder.create(this, "Listener Rule")
.action(ListenerAction.forward(listOf(defaultTargetGroup)))
.conditions(listOf(ListenerCondition.hostHeaders(listOf(hostName))))
.listener(httpsListener)
.priority(1)
.build()
I shouldn’t have to add the priority myself as I don’t rely on priority matches when using host-based rules.
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:5 (1 by maintainers)
Top GitHub Comments
Is there anything new on this one @ericzbeard @rix0rrr or others? It’s a serious deficiency (although I know it’s the fault of underlying AWS, not cdk), that makes it extremely hard to use CDK for deployments involving multiple listener rules. We really don’t want to micro-manage priority for hundreds of services that each have a forward rule on the ALBs…
The workaround with hashes is… fragile. I appreciate it as a temporary measure, but I really don’t want fragility in my ops deployments…
Our current workaround is to assign a priority based on hashing the rule’s unique ID. In Clojure:
It’s prone to hash collisions but we were lucky so far.