Skip to content

Instantly share code, notes, and snippets.

@lawliet89
Created September 3, 2018 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lawliet89/63c1f6ed32a15e67d25832fb3712d623 to your computer and use it in GitHub Desktop.
Save lawliet89/63c1f6ed32a15e67d25832fb3712d623 to your computer and use it in GitHub Desktop.
Terraform Demo Snippet
# 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