terraform-aws-alb
terraform-aws-alb copied to clipboard
WSS support
Hey 👋
This ALB module is awesome, but for our GraphQL server (with subscriptions 😎 ), it'd be essential to have WS target group ~& security group rule~.
Describe the Feature
Add TLS target group ~& Security Group Rule for TCP access~. A simple solution would use the same port for both HTTP and WS
Expected Behavior
Connections from both HTTP, HTTPS, and TCP allowed in through the ALB.
Use Case
Any service that requires both REST & Websocket support on the same endpoint
Describe Ideal Solution
variable "wss_enabled" {
type = bool
description = "Enables WSS target group for ALB"
default = false
}
Using variable wss_enabled
to add said target group and security group rule
resource "aws_lb_target_group" "wss" {
count = var.wss_enabled ? 1 : 0
name = var.target_group_name == "" ? module.default_target_group_label.id : var.target_group_name
port = var.target_group_port
protocol = "TLS"
vpc_id = var.vpc_id
target_type = var.target_group_target_type
deregistration_delay = var.deregistration_delay
health_check {
path = var.health_check_path
}
dynamic "stickiness" {
for_each = var.stickiness == null ? [] : [var.stickiness]
content {
type = "lb_cookie"
cookie_duration = stickiness.value.cookie_duration
enabled = var.target_group_protocol == "TCP" ? false : stickiness.value.enabled
}
}
lifecycle {
create_before_destroy = true
}
tags = merge(
module.default_target_group_label.tags,
var.target_group_additional_tags
)
}
This is my first feature request on terraform modules, please advise if my request is not pertinent. 🙇
Thanks 👋
Thanks for creating this issue.
Not sure I completely understand. Why can you not manipulate the current variables in the module to change the current target group ? Why does this request require a whole new aws_lb_target_group
resource ?