Created
September 3, 2018 04:44
-
-
Save lawliet89/63c1f6ed32a15e67d25832fb3712d623 to your computer and use it in GitHub Desktop.
Terraform Demo Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HTTP listener to redirect to HTTPS | |
resource "aws_lb_listener" "front_end" { | |
load_balancer_arn = "${aws_lb.lb.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.lb.arn}" | |
port = "443" | |
protocol = "HTTPS" | |
ssl_policy = "ELBSecurityPolicy-TLS-1-2-2017-01" | |
certificate_arn = "${var.certificate_arn}" | |
default_action { | |
target_group_arn = "${aws_lb_target_group.sink.arn}" | |
type = "forward" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment