Skip to content

Commit

Permalink
Merge pull request #36 from hashicorp/bf-add-port-80
Browse files Browse the repository at this point in the history
Open up port 80 and have the LB forward to 443
  • Loading branch information
bnferguson authored Nov 8, 2019
2 parents e1cf98a + 89d4762 commit 86d56f2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/common-user-vpc/security_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ resource "aws_security_group" "allow_ptfe" {
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
description = "http to ptfe application"

protocol = "tcp"
from_port = 80
to_port = 80

cidr_blocks = ["0.0.0.0/0"]
}

ingress {
description = "https to ptfe application"

Expand Down
16 changes: 16 additions & 0 deletions modules/lb/elb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ resource "aws_lb_target_group" "admin" {
}
}

resource "aws_lb_listener" "http" {
load_balancer_arn = "${aws_lb.ptfe.arn}"
port = "80"
protocol = "HTTP"

default_action {
type = "redirect"

redirect {
port = "443"
protocol = "HTTPS"
status_code = "HTTP_301"
}
}
}

resource "aws_lb_listener" "https" {
load_balancer_arn = "${aws_lb.ptfe.arn}"
port = "443"
Expand Down
8 changes: 8 additions & 0 deletions modules/lb/security-groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ resource "aws_security_group" "lb_public" {
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
description = "http to ptfe application"
protocol = "tcp"
from_port = 80
to_port = 80
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
description = "https to ptfe application"
protocol = "tcp"
Expand Down

0 comments on commit 86d56f2

Please sign in to comment.