ECS tg 는 따로 생성 해서 붙여줌
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#대상그룹 생성------------------------------------------------------------------------------------------
/*
resource "aws_lb_target_group" "project-stg-api-alb-tg" {
name = "project-stg-api-alb-tg"
port = 28083
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
deregistration_delay = 10
health_check {
enabled = true
interval = 13
path = "/v1/login/session"
timeout = 10
matcher = "200"
healthy_threshold = 2
unhealthy_threshold = 9
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-admin-alb-tg" {
name = "project-stg-admin-alb-tg"
port = 28081
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
deregistration_delay = 10
health_check {
enabled = true
interval = 13
path = "/admin/login?redirectURL=/"
timeout = 10
matcher = "200"
healthy_threshold = 2
unhealthy_threshold = 9
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-cron-alb-tg" {
name = "project-stg-cron-alb-tg"
port = 28082
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
deregistration_delay = 10
health_check {
enabled = true
interval = 13
path = "/admin/login?redirectURL=/"
timeout = 10
matcher = "200"
healthy_threshold = 2
unhealthy_threshold = 9
}
lifecycle {
#create_before_destroy = true
}
}
*/
resource "aws_lb_target_group" "project-stg-jenkins-alb-tg" {
name = "project-stg-jenkins-alb-tg"
port = 9090
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 300
path = "/login?from=%2F"
timeout = 60
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-thumbor-alb-tg" {
name = "project-stg-thumbor-alb-tg"
port = 9000
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 300
path = "/status"
timeout = 60
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-prometheus-alb-tg" {
name = "project-stg-prometheus-alb-tg"
port = 9090
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 20
path = "/healthy"
timeout = 10
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-grafana-alb-tg" {
name = "project-stg-grafana-alb-tg"
port = 3000
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 20
path = "/api/health"
timeout = 10
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-chatting-alb-tg" {
name = "project-stg-chatting-alb-tg"
port = 8008
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 20
path = "/"
timeout = 10
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-chatting-admin-tg" {
name = "project-stg-chatting-admin-tg"
port = 80
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 20
path = "/"
timeout = 10
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-elk-elastic-tg" {
name = "project-stg-elk-elastic-tg"
port = 9200
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 20
path = "/"
timeout = 10
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-elk-kibana-tg" {
name = "project-stg-elk-kibana-tg"
port = 5601
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 20
path = "/"
timeout = 10
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
resource "aws_lb_target_group" "project-stg-elk-logstash-tg" {
name = "project-stg-elk-logstash-tg"
port = 5044
protocol = "HTTP"
vpc_id = aws_vpc.project-stg-vpc.id
target_type = "instance"
health_check {
enabled = true
interval = 20
path = "/"
timeout = 10
matcher = "200"
healthy_threshold = 5
unhealthy_threshold = 5
}
lifecycle {
#create_before_destroy = true
}
}
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
#대상 그룹 타겟
resource "aws_lb_target_group_attachment" "jenkins" {
target_group_arn = aws_lb_target_group.project-stg-jenkins-alb-tg.arn
count = 1
target_id = aws_instance.project-stg-jenkins[count.index].id
port = 9090
}
resource "aws_lb_target_group_attachment" "prometheus" {
target_group_arn = aws_lb_target_group.project-stg-prometheus-alb-tg.arn
count = 1
target_id = aws_instance.project-stg-prometheus[count.index].id
port = 9090
}
resource "aws_lb_target_group_attachment" "grafana" {
target_group_arn = aws_lb_target_group.project-stg-grafana-alb-tg.arn
count = 1
target_id = aws_instance.project-stg-grafana[count.index].id
port = 3000
}
resource "aws_lb_target_group_attachment" "thumbor" {
target_group_arn = aws_lb_target_group.project-stg-thumbor-alb-tg.arn
count = 1
target_id = aws_instance.project-stg-thumbor[count.index].id
port = 9000
}
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
'Terraform' 카테고리의 다른 글
terraform code(route53) (0) | 2023.09.04 |
---|---|
terraform code(provider) (0) | 2023.08.31 |
terraform code (alb) (0) | 2023.08.31 |
terraform code (ec2) (0) | 2023.08.31 |
terraform code (network) (0) | 2023.08.31 |