Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit 86d56f2

Browse files
author
Brandon Ferguson
authored
Merge pull request #36 from hashicorp/bf-add-port-80
Open up port 80 and have the LB forward to 443
2 parents e1cf98a + 89d4762 commit 86d56f2

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

modules/common-user-vpc/security_groups.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ resource "aws_security_group" "allow_ptfe" {
5252
cidr_blocks = ["0.0.0.0/0"]
5353
}
5454

55+
ingress {
56+
description = "http to ptfe application"
57+
58+
protocol = "tcp"
59+
from_port = 80
60+
to_port = 80
61+
62+
cidr_blocks = ["0.0.0.0/0"]
63+
}
64+
5565
ingress {
5666
description = "https to ptfe application"
5767

modules/lb/elb.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ resource "aws_lb_target_group" "admin" {
3737
}
3838
}
3939

40+
resource "aws_lb_listener" "http" {
41+
load_balancer_arn = "${aws_lb.ptfe.arn}"
42+
port = "80"
43+
protocol = "HTTP"
44+
45+
default_action {
46+
type = "redirect"
47+
48+
redirect {
49+
port = "443"
50+
protocol = "HTTPS"
51+
status_code = "HTTP_301"
52+
}
53+
}
54+
}
55+
4056
resource "aws_lb_listener" "https" {
4157
load_balancer_arn = "${aws_lb.ptfe.arn}"
4258
port = "443"

modules/lb/security-groups.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ resource "aws_security_group" "lb_public" {
3939
cidr_blocks = ["0.0.0.0/0"]
4040
}
4141

42+
ingress {
43+
description = "http to ptfe application"
44+
protocol = "tcp"
45+
from_port = 80
46+
to_port = 80
47+
cidr_blocks = ["0.0.0.0/0"]
48+
}
49+
4250
ingress {
4351
description = "https to ptfe application"
4452
protocol = "tcp"

0 commit comments

Comments
 (0)