Skip to content

Instantly share code, notes, and snippets.

@ben-x
Last active September 1, 2024 02:07
Show Gist options
  • Save ben-x/23b23b74eb1d37e50450377b67b79f6a to your computer and use it in GitHub Desktop.
Save ben-x/23b23b74eb1d37e50450377b67b79f6a to your computer and use it in GitHub Desktop.
Load balancer. Part of multi-region-with-single-workload project
resource "aws_lb_target_group" "central_app_tg" {
name = "central-app-tg"
port = var.app_port
protocol = "HTTP"
target_type = "ip"
ip_address_type = "ipv4"
tags = var.tags
vpc_id = aws_vpc.main.id
health_check {
enabled = true
healthy_threshold = 2
interval = 15
protocol = "HTTP"
timeout = 10
unhealthy_threshold = 2
}
}
module "app_alb" {
source = "../../../common-modules/aws-alb"
allow_all_egress = true
enable_deletion_protection = false
idle_timeout_seconds = "60"
is_internal = false
name = "app-alb"
tags = var.tags
listener_config = {
http_port_80 = {
protocol = "HTTP"
port = "80"
}
http_port_443 = {
protocol = "HTTPS"
port = "443"
certificate_arn = var.dns_config.cert_arn
}
}
vpc = {
id = aws_vpc.main.id
cidr_block = aws_vpc.main.cidr_block
subnet_ids = local.public_subnet_ids
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment