50 lines
1.3 KiB
HCL
50 lines
1.3 KiB
HCL
resource "aws_lb_target_group" "hff_entry_forms_api" {
|
|
name = "${local.environment_name}-${substr(uuid(), 0, 2)}"
|
|
port = var.target_port
|
|
protocol = "HTTP"
|
|
target_type = "instance"
|
|
vpc_id = data.terraform_remote_state.jdbsoft.outputs.aws_vpc_jdbsoft.id
|
|
|
|
health_check {
|
|
enabled = true
|
|
matcher = "200"
|
|
path = "/v1/version"
|
|
}
|
|
|
|
lifecycle {
|
|
create_before_destroy = true
|
|
ignore_changes = [name]
|
|
}
|
|
|
|
tags = {
|
|
Name = local.api_domain_name
|
|
Environment = local.environment_name
|
|
}
|
|
}
|
|
|
|
resource "aws_lb_listener_rule" "hff_entry_forms_api" {
|
|
listener_arn = data.terraform_remote_state.jdbsoft.outputs.aws_lb_listener_https.arn
|
|
|
|
action {
|
|
type = "forward"
|
|
target_group_arn = aws_lb_target_group.hff_entry_forms_api.arn
|
|
}
|
|
|
|
condition {
|
|
host_header {
|
|
values = [ local.api_domain_name ]
|
|
}
|
|
}
|
|
|
|
tags = {
|
|
Name = "${local.api_domain_name} HTTPS"
|
|
Environment = local.environment_name
|
|
}
|
|
}
|
|
|
|
resource "aws_lb_target_group_attachment" "hff_entry_forms_api" {
|
|
target_group_arn = aws_lb_target_group.hff_entry_forms_api.arn
|
|
target_id = data.terraform_remote_state.jdbsoft.outputs.sobeck-instance-id
|
|
port = var.target_port
|
|
}
|