Skip to content

Adds key to TG name #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ resource "aws_lb_target_group" "lb_http_tgs" {
for name, config in var.http_ports : name => config
if lookup(config, "type", "") == "" || lookup(config, "type", "") == "forward"
}
name = "${var.name_prefix}-http-${each.value.target_group_port}"
name = "${var.name_prefix}-${each.key}-http-${each.value.target_group_port}"
port = each.value.target_group_port
protocol = lookup(each.value, "target_group_protocol", "") == "" ? "HTTP" : each.value.target_group_protocol
protocol = lookup(each.value, "target_group_protocol", "HTTP")
vpc_id = var.vpc_id
deregistration_delay = var.deregistration_delay
slow_start = var.slow_start
Expand All @@ -139,7 +139,7 @@ resource "aws_lb_target_group" "lb_http_tgs" {
enabled = var.target_group_health_check_enabled
interval = var.target_group_health_check_interval
path = var.target_group_health_check_path
protocol = lookup(each.value, "target_group_protocol", "") == "" ? "HTTP" : each.value.target_group_protocol
protocol = lookup(each.value, "target_group_protocol", "HTTP")
timeout = var.target_group_health_check_timeout
healthy_threshold = var.target_group_health_check_healthy_threshold
unhealthy_threshold = var.target_group_health_check_unhealthy_threshold
Expand All @@ -149,7 +149,7 @@ resource "aws_lb_target_group" "lb_http_tgs" {
tags = merge(
var.tags,
{
Name = "${var.name_prefix}-http-${each.value.target_group_port}"
Name = "${var.name_prefix}-${each.key}-http-${each.value.target_group_port}"
},
)
lifecycle {
Expand All @@ -163,9 +163,9 @@ resource "aws_lb_target_group" "lb_https_tgs" {
for name, config in var.https_ports : name => config
if lookup(config, "type", "") == "" || lookup(config, "type", "") == "forward"
}
name = "${var.name_prefix}-https-${each.value.target_group_port}"
name = "${var.name_prefix}-${each.key}-https-${each.value.target_group_port}"
port = each.value.target_group_port
protocol = lookup(each.value, "target_group_protocol", "") == "" ? "HTTPS" : each.value.target_group_protocol
protocol = lookup(each.value, "target_group_protocol", "HTTPS")
vpc_id = var.vpc_id
deregistration_delay = var.deregistration_delay
slow_start = var.slow_start
Expand All @@ -182,7 +182,7 @@ resource "aws_lb_target_group" "lb_https_tgs" {
enabled = var.target_group_health_check_enabled
interval = var.target_group_health_check_interval
path = var.target_group_health_check_path
protocol = lookup(each.value, "target_group_protocol", "") == "" ? "HTTPS" : each.value.target_group_protocol
protocol = lookup(each.value, "target_group_protocol", "HTTPS")
timeout = var.target_group_health_check_timeout
healthy_threshold = var.target_group_health_check_healthy_threshold
unhealthy_threshold = var.target_group_health_check_unhealthy_threshold
Expand All @@ -192,7 +192,7 @@ resource "aws_lb_target_group" "lb_https_tgs" {
tags = merge(
var.tags,
{
Name = "${var.name_prefix}-https-${each.value.target_group_port}"
Name = "${var.name_prefix}-${each.key}-https-${each.value.target_group_port}"
},
)
lifecycle {
Expand Down