인프런 커뮤니티 질문&답변
4.alb 오류 (Call to function "element" failed: cannot use element function with an empty list.)
작성
·
299
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 //선택한 인스턴스를 위한 포트
}
퀴즈
61%나 틀려요. 한번 도전해보세요!
AWS에서 EC2 인스턴스나 RDS 데이터베이스의 네트워크 트래픽을 제어하는 가상 방화벽 역할을 하는 서비스는 무엇일까요?
VPC
보안 그룹(Security Group)
라우팅 테이블(Routing Table)
탄력적 IP(Elastic IP)





