• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

4.alb 오류 (Call to function "element" failed: cannot use element function with an empty list.)

24.03.02 12:47 작성 조회수 84

1

 4.alb apply 할 경우 아래와 같이 오류가 발생 합니다.

Call to function "element" failed: cannot use element function with an empty list.

 

관련해서 아래와 같이 수정

# 대상 등록
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group_attachment
resource "aws_lb_target_group_attachment" "attachment" {
  count = length(data.aws_instances.tag.ids)
  target_group_arn = aws_lb_target_group.tg.arn
  target_id = element(data.aws_instances.tag.ids, count.index)
  port             = 3000 //선택한 인스턴스를 위한 포트
}

 

 

답변 1

답변을 작성해보세요.

0

이슈 파악 및 해결 책 감사합니다.

해당 내용 및 코드 수정하였습니다.

감사합니다.