Skip to content

Commit 91c031a

Browse files
Merge pull request #47 from egarbi/custom_alb_listener_ports
Adds 2 new variables to control listener ports of ALB
2 parents 70b2759 + 4fd7ad3 commit 91c031a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ resource "aws_alb_target_group" "target_group" {
5555

5656
resource "aws_alb_listener" "frontend_http" {
5757
load_balancer_arn = "${aws_alb.main.arn}"
58-
port = "80"
58+
port = "${var.alb_http_port}"
5959
protocol = "HTTP"
6060
count = "${contains(var.alb_protocols, "HTTP") ? 1 : 0}"
6161

@@ -69,7 +69,7 @@ resource "aws_alb_listener" "frontend_http" {
6969

7070
resource "aws_alb_listener" "frontend_https" {
7171
load_balancer_arn = "${aws_alb.main.arn}"
72-
port = "443"
72+
port = "${var.alb_https_port}"
7373
protocol = "HTTPS"
7474
certificate_arn = "${var.certificate_arn}"
7575
ssl_policy = "${var.security_policy}"

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ variable "alb_is_internal" {
33
default = false
44
}
55

6+
variable "alb_http_port" {
7+
description = "The port the Load Balancer listen when HTTP is used"
8+
default = 80
9+
}
10+
11+
variable "alb_https_port" {
12+
description = "The port the Load Balancer listen when HTTPS is used"
13+
default = 443
14+
}
15+
616
variable "alb_name" {
717
description = "The name of the ALB as will show in the AWS EC2 ELB console."
818
}

0 commit comments

Comments
 (0)