cn-terraform/terraform-aws-ecs-fargate-service

How is custom_lb_arn being used

jastsai opened this issue · 2 comments

Hi,

I am wondering how var.custom_lb_arn is used? It seems the follow code snippet is the only place the variable is used, but I would like to use a custom load balancer in the service... how?

module "ecs-alb" {
count = var.custom_lb_arn == null ? 1 : 0

source = "cn-terraform/ecs-alb/aws"
version = "1.0.28"

Thanks,
Jason

@jnonino Same question here I use it from the fargate module but it's clearly not working

│ 
│   on .terraform/modules/ecs-fargate.ecs-fargate-service/main.tf line 83, in resource "aws_ecs_service" "service":
│   83:     for_each = module.ecs-alb[0].lb_http_tgs_map_arn_port
│     ├────────────────
│     │ module.ecs-alb is empty tuple
│ 
│ The given key does not identify an element in this collection value: the collection has no elements.
╵
╷
│ Error: Invalid index
│ 
│   on .terraform/modules/ecs-fargate.ecs-fargate-service/main.tf line 91, in resource "aws_ecs_service" "service":
│   91:     for_each = module.ecs-alb[0].lb_https_tgs_map_arn_port
│     ├────────────────
│     │ module.ecs-alb is empty tuple
│ 
│ The given key does not identify an element in this collection value: the collection has no elements.
╵
╷
│ Error: Invalid index
│ 
│   on .terraform/modules/ecs-fargate.ecs-fargate-service/main.tf line 174, in resource "aws_security_group_rule" "ingress_through_http_and_https":
│  174:   for_each                 = toset(concat(module.ecs-alb[0].lb_https_tgs_ports, module.ecs-alb[0].lb_http_tgs_ports))
│     ├────────────────
│     │ module.ecs-alb is empty tuple
│ 
│ The given key does not identify an element in this collection value: the collection has no elements.
╵
╷
│ Error: Invalid index
│ 
│   on .terraform/modules/ecs-fargate.ecs-fargate-service/main.tf line 174, in resource "aws_security_group_rule" "ingress_through_http_and_https":
│  174:   for_each                 = toset(concat(module.ecs-alb[0].lb_https_tgs_ports, module.ecs-alb[0].lb_http_tgs_ports))
│     ├────────────────
│     │ module.ecs-alb is empty tuple
│ 
│ The given key does not identify an element in this collection value: the collection has no elements.

@jnonino looks like this functionality is broken.

I was actually looking for a way to avoid creating an ALB as I'm using Traefik and I don't want to create an ALB per service.