From 2f3ecf7b6002dee20cb702ff5440b578edec36f3 Mon Sep 17 00:00:00 2001 From: Rajat Pandit Date: Thu, 6 Jul 2017 17:52:01 +0530 Subject: [PATCH] updated to allow access to other protocols e.g. tcp --- elb_http/README.md | 4 ++-- elb_http/main.tf | 4 ++-- elb_http/variables.tf | 13 +++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/elb_http/README.md b/elb_http/README.md index 502bd58..1fc7abb 100644 --- a/elb_http/README.md +++ b/elb_http/README.md @@ -27,9 +27,9 @@ Input Variables the ELB have an internal IP - `subnet_az1` - The VPC subnet ID for AZ1 - `subnet_az2` - The VPC subnet ID for AZ2 -- `backend_port` - The port the service running on the EC2 insances +- `(frontend_port | backend_port)` - The port the service running on/off the EC2 insances will listen on. -- `backend_protocol` - The protocol the service on the backend_port +- `(frontend_port | backend_protocol)` - The protocol the service on the frontend_port/backend_port understands, e.g. `http` - The possible options are: - http diff --git a/elb_http/main.tf b/elb_http/main.tf index 2491346..94a0d6f 100644 --- a/elb_http/main.tf +++ b/elb_http/main.tf @@ -23,8 +23,8 @@ resource "aws_elb" "elb" { listener { instance_port = "${var.backend_port}" instance_protocol = "${var.backend_protocol}" - lb_port = 80 - lb_protocol = "http" + lb_port = "${var.frontend_port}" + lb_protocol = "${var.frontend_protocol}" } health_check { diff --git a/elb_http/variables.tf b/elb_http/variables.tf index a9ea28c..945d9a4 100644 --- a/elb_http/variables.tf +++ b/elb_http/variables.tf @@ -35,6 +35,19 @@ variable "backend_protocol" { // - ssl (secure tcp) } +variable "frontend_port" { + description = "The port the service on the EC2 instances listens on" +} + +variable "frontend_protocol" { + description = "The protocol the backend service speaks" + // Possible options are + // - http + // - https + // - tcp + // - ssl (secure tcp) +} + variable "health_check_target" { description = "The URL the ELB should use for health checks" // This is primarily used with `http` or `https` backend protocols