From 91e6400587086ae0747ef9b1ed7603c7222e4a8c Mon Sep 17 00:00:00 2001 From: Steven Nemetz Date: Tue, 5 Jun 2018 13:57:33 -0700 Subject: [PATCH] Add option to set target-type for target groups --- main.tf | 19 ++++++++++--------- variables.tf | 5 +++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/main.tf b/main.tf index 850aba4..12bcef8 100644 --- a/main.tf +++ b/main.tf @@ -257,12 +257,12 @@ resource "aws_lb_target_group" "application-http" { list(element(compact(split(",",local.instance_http_ports)), count.index)) )}" - port = "${element(compact(split(",",local.instance_http_ports)), count.index)}" - protocol = "HTTP" - vpc_id = "${var.vpc_id}" + port = "${element(compact(split(",",local.instance_http_ports)), count.index)}" + protocol = "HTTP" + target_type = "${var.target_type}" + vpc_id = "${var.vpc_id}" #deregistration_delay = "${}" - #target_type = "${}" health_check { interval = "${var.health_check_interval}" path = "${var.health_check_path}" @@ -300,12 +300,12 @@ resource "aws_lb_target_group" "application-https" { list(element(compact(split(",",local.instance_https_ports)), count.index)) )}" - port = "${element(compact(split(",",local.instance_https_ports)), count.index)}" - protocol = "HTTP" - vpc_id = "${var.vpc_id}" + port = "${element(compact(split(",",local.instance_https_ports)), count.index)}" + protocol = "HTTP" + target_type = "${var.target_type}" + vpc_id = "${var.vpc_id}" #deregistration_delay = "${}" - #target_type = "${}" health_check { interval = "${var.health_check_interval}" path = "${var.health_check_path}" @@ -372,10 +372,10 @@ resource "aws_lb_target_group" "network" { protocol = "TCP" stickiness = [] tags = "${module.label.tags}" + target_type = "${var.target_type}" vpc_id = "${var.vpc_id}" #deregistration_delay = "${}" - #target_type = "${}" lifecycle { create_before_destroy = true } @@ -462,3 +462,4 @@ resource "aws_lb_listener_rule" "this" { } } */ + diff --git a/variables.tf b/variables.tf index 061deec..7a40204 100644 --- a/variables.tf +++ b/variables.tf @@ -231,6 +231,11 @@ variable "lb_tcp_ports" { default = "" } +variable "target_type" { + description = "Type for targets for target group. Can be: instance or ip" + default = "instance" +} + /// /// Health Checks ///