operations: Complete migration to AWS ECS.
This commit is contained in:
43
operations/terraform/deployed_env/load-balancer.tf
Normal file
43
operations/terraform/deployed_env/load-balancer.tf
Normal file
@ -0,0 +1,43 @@
|
||||
resource "aws_lb_target_group" "pmapi" {
|
||||
name = "${local.environment_name}-${substr(uuid(), 0, 2)}"
|
||||
port = 80
|
||||
protocol = "HTTP"
|
||||
target_type = "instance"
|
||||
vpc_id = data.terraform_remote_state.jdbsoft.outputs.aws_vpc_jdbsoft.id
|
||||
|
||||
health_check {
|
||||
enabled = true
|
||||
matcher = "200"
|
||||
path = "/v0/version"
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
ignore_changes = [name]
|
||||
}
|
||||
|
||||
tags = {
|
||||
Name = local.api_domain_name
|
||||
Environment = local.environment_name
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_lb_listener_rule" "pmapi" {
|
||||
listener_arn = data.terraform_remote_state.jdbsoft.outputs.aws_lb_listener_https.arn
|
||||
|
||||
action {
|
||||
type = "forward"
|
||||
target_group_arn = aws_lb_target_group.pmapi.arn
|
||||
}
|
||||
|
||||
condition {
|
||||
host_header {
|
||||
values = [ local.api_domain_name ]
|
||||
}
|
||||
}
|
||||
|
||||
tags = {
|
||||
Name = "${local.api_domain_name} HTTPS"
|
||||
Environment = local.environment_name
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user