From ed63eb36b7e52c3648bdefc9224dfd2156b2f3f0 Mon Sep 17 00:00:00 2001 From: Idi Eradiri Date: Sat, 13 Jun 2020 16:50:38 -0400 Subject: [PATCH] feat: target group protocol variable (#38) * feat: target group protocol variable for HTTP/HTTPS healthcheck * Updated README.md Co-authored-by: Idikoro Eradiri Co-authored-by: actions-bot <58130806+actions-bot@users.noreply.github.com> Co-authored-by: Erik Osterman --- README.md | 1 + docs/terraform.md | 1 + main.tf | 3 ++- variables.tf | 6 ++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14443b2..72a0cea 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,7 @@ Available targets: | target_group_additional_tags | The additional tags to apply to the target group | map(string) | `` | no | | target_group_name | The name for the default target group, uses a module label name if left empty | string | `` | no | | target_group_port | The port for the default target group | number | `80` | no | +| target_group_protocol | The protocol for the default target group HTTP or HTTPS | string | `HTTP` | no | | target_group_target_type | The type (`instance`, `ip` or `lambda`) of targets that can be registered with the target group | string | `ip` | no | | vpc_id | VPC ID to associate with ALB | string | - | yes | diff --git a/docs/terraform.md b/docs/terraform.md index 924b672..417c434 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -42,6 +42,7 @@ | target_group_additional_tags | The additional tags to apply to the target group | map(string) | `` | no | | target_group_name | The name for the default target group, uses a module label name if left empty | string | `` | no | | target_group_port | The port for the default target group | number | `80` | no | +| target_group_protocol | The protocol for the default target group HTTP or HTTPS | string | `HTTP` | no | | target_group_target_type | The type (`instance`, `ip` or `lambda`) of targets that can be registered with the target group | string | `ip` | no | | vpc_id | VPC ID to associate with ALB | string | - | yes | diff --git a/main.tf b/main.tf index 5514a9e..d24313a 100644 --- a/main.tf +++ b/main.tf @@ -99,12 +99,13 @@ module "default_target_group_label" { resource "aws_lb_target_group" "default" { name = var.target_group_name == "" ? module.default_target_group_label.id : var.target_group_name port = var.target_group_port - protocol = "HTTP" + protocol = var.target_group_protocol vpc_id = var.vpc_id target_type = var.target_group_target_type deregistration_delay = var.deregistration_delay health_check { + protocol = var.target_group_protocol path = var.health_check_path timeout = var.health_check_timeout healthy_threshold = var.health_check_healthy_threshold diff --git a/variables.tf b/variables.tf index 148b24a..be13398 100644 --- a/variables.tf +++ b/variables.tf @@ -229,6 +229,12 @@ variable "target_group_port" { description = "The port for the default target group" } +variable "target_group_protocol" { + type = string + default = "HTTP" + description = "The protocol for the default target group HTTP or HTTPS" +} + variable "target_group_name" { type = string default = ""