Make ALB listener configurable
This commit is contained in:
parent
e69d47f81c
commit
47366b2aa1
|
@ -45,4 +45,5 @@ module "stack" {
|
|||
|
||||
alb_ssl_policy = "${var.alb_ssl_policy}"
|
||||
alb_certificate_arn = "${var.alb_certificate_arn}"
|
||||
use_ssl = "${var.use_ssl}"
|
||||
}
|
||||
|
|
|
@ -162,3 +162,8 @@ variable "alb_certificate_arn" {
|
|||
description = "The Certificate ARN for the Applicationn Load Balancer Policy"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "use_ssl" {
|
||||
description = "Enable SSL"
|
||||
default = "true"
|
||||
}
|
|
@ -58,8 +58,22 @@ resource "aws_lb_target_group" "explorer" {
|
|||
}
|
||||
}
|
||||
|
||||
# The Listener for the ALB
|
||||
resource "aws_alb_listener" "alb_listener" {
|
||||
# The Listener for the ALB (HTTP protocol)
|
||||
resource "aws_alb_listener" "alb_listener_http" {
|
||||
count = "${var.use_ssl == "true" ? 0 : 1}"
|
||||
load_balancer_arn = "${aws_lb.explorer.arn}"
|
||||
port = 80
|
||||
protocol = "HTTP"
|
||||
|
||||
default_action {
|
||||
type = "forward"
|
||||
target_group_arn = "${aws_lb_target_group.explorer.arn}"
|
||||
}
|
||||
}
|
||||
|
||||
# The Listener for the ALB (HTTPS protocol)
|
||||
resource "aws_alb_listener" "alb_listener_https" {
|
||||
count = "${var.use_ssl == "true" ? 1 : 0}"
|
||||
load_balancer_arn = "${aws_lb.explorer.arn}"
|
||||
port = 443
|
||||
protocol = "HTTPS"
|
||||
|
|
|
@ -52,3 +52,4 @@ variable "new_relic_license_key" {}
|
|||
variable "secret_key_base" {}
|
||||
variable "alb_ssl_policy" {}
|
||||
variable "alb_certificate_arn" {}
|
||||
variable "use_ssl" {}
|
Loading…
Reference in New Issue