Skip to content

Commit

Permalink
Add http to https redirect (#9)
Browse files Browse the repository at this point in the history
* Reorder settings

* Added listen http always

* Made default values to save previous behaviourr

* Address PR comments
  • Loading branch information
goruha authored Sep 22, 2017
1 parent e5d3819 commit c3b709a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
setting {
namespace = "aws:elb:listener"
name = "ListenerEnabled"
value = "${var.loadbalancer_certificate_arn == "" ? "true" : "false"}"
value = "${var.http_listener_enabled || var.loadbalancer_certificate_arn == "" ? "true" : "false"}"
}
setting {
namespace = "aws:elb:listener:443"
Expand Down Expand Up @@ -536,7 +536,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
setting {
namespace = "aws:elbv2:listener:default"
name = "ListenerEnabled"
value = "${var.loadbalancer_certificate_arn == "" ? "true" : "false"}"
value = "${var.http_listener_enabled || var.loadbalancer_certificate_arn == "" ? "true" : "false"}"
}
setting {
namespace = "aws:elbv2:listener:443"
Expand All @@ -553,6 +553,12 @@ resource "aws_elastic_beanstalk_environment" "default" {
name = "SSLCertificateArns"
value = "${var.loadbalancer_certificate_arn}"
}
setting {
namespace = "aws:elasticbeanstalk:application"
name = "Application Healthcheck URL"
value = "HTTP:80${var.healthcheck_url}"
}

setting {
namespace = "aws:elasticbeanstalk:environment"
name = "LoadBalancerType"
Expand All @@ -563,11 +569,6 @@ resource "aws_elastic_beanstalk_environment" "default" {
name = "ServiceRole"
value = "${aws_iam_role.service.name}"
}
setting {
namespace = "aws:elasticbeanstalk:application"
name = "Application Healthcheck URL"
value = "HTTP:80${var.healthcheck_url}"
}
setting {
namespace = "aws:elasticbeanstalk:healthreporting:system"
name = "SystemType"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ variable "loadbalancer_certificate_arn" {
default = ""
}

variable "http_listener_enabled" {
default = false
}


variable "zone_id" {
default = ""
}
Expand Down

0 comments on commit c3b709a

Please sign in to comment.