forked from turnerlabs/terraform-ecs-fargate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlb-https.tf
32 lines (27 loc) · 856 Bytes
/
lb-https.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# adds an https listener to the load balancer
# (delete this file if you only want http)
# The port to listen on for HTTPS, always use 443
variable "https_port" {
default = "443"
}
# The ARN for the SSL certificate
variable "certificate_arn" {}
resource "aws_alb_listener" "https" {
load_balancer_arn = aws_alb.main.id
port = var.https_port
protocol = "HTTPS"
certificate_arn = var.certificate_arn
default_action {
target_group_arn = aws_alb_target_group.main.id
type = "forward"
}
}
resource "aws_security_group_rule" "ingress_lb_https" {
type = "ingress"
description = "HTTPS"
from_port = var.https_port
to_port = var.https_port
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_security_group.nsg_lb.id
}