From 6c55244c64d84c6f48a4b02624e3886d3d5d887c Mon Sep 17 00:00:00 2001 From: Mateusz Kolakowski Date: Mon, 16 Dec 2024 17:31:01 +0000 Subject: [PATCH] Tribunals: Add LB TG attachments back in (#9100) --- terraform/environments/tribunals/load_balancer.tf | 14 +++++++------- .../environments/tribunals/load_balancer_sftp.tf | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/terraform/environments/tribunals/load_balancer.tf b/terraform/environments/tribunals/load_balancer.tf index 7d61f760154..2c1237b611e 100644 --- a/terraform/environments/tribunals/load_balancer.tf +++ b/terraform/environments/tribunals/load_balancer.tf @@ -111,13 +111,13 @@ data "aws_instances" "backup_instance" { # Make sure that the ec2 instance tagged as 'tribunals-instance' exists # before adding aws_lb_target_group_attachment, otherwise terraform will fail -# resource "aws_lb_target_group_attachment" "tribunals_target_group_attachment" { -# for_each = aws_lb_target_group.tribunals_target_group -# target_group_arn = each.value.arn -# # target_id points to primary ec2 instance, change "primary_instance" to "backup_instance" in order to point at backup ec2 instance -# target_id = data.aws_instances.primary_instance.ids[0] -# port = each.value.port -# } +resource "aws_lb_target_group_attachment" "tribunals_target_group_attachment" { + for_each = aws_lb_target_group.tribunals_target_group + target_group_arn = each.value.arn + # target_id points to primary ec2 instance, change "primary_instance" to "backup_instance" in order to point at backup ec2 instance + target_id = data.aws_instances.primary_instance.ids[0] + port = each.value.port +} resource "aws_lb_listener" "tribunals_lb" { depends_on = [ diff --git a/terraform/environments/tribunals/load_balancer_sftp.tf b/terraform/environments/tribunals/load_balancer_sftp.tf index e96962cf2c5..6d61d386a73 100644 --- a/terraform/environments/tribunals/load_balancer_sftp.tf +++ b/terraform/environments/tribunals/load_balancer_sftp.tf @@ -67,10 +67,10 @@ resource "aws_lb_target_group" "tribunals_target_group_sftp" { # Make sure that the ec2 instance tagged as 'tribunals-instance' exists # before adding aws_lb_target_group_attachment, otherwise terraform will fail -# resource "aws_lb_target_group_attachment" "tribunals_target_group_attachment_sftp" { -# for_each = aws_lb_target_group.tribunals_target_group_sftp -# target_group_arn = each.value.arn -# # target_id points to primary ec2 instance, change "primary_instance" to "backup_instance" in order to point at backup ec2 instance -# target_id = data.aws_instances.primary_instance.ids[0] -# port = each.value.port -# } +resource "aws_lb_target_group_attachment" "tribunals_target_group_attachment_sftp" { + for_each = aws_lb_target_group.tribunals_target_group_sftp + target_group_arn = each.value.arn + # target_id points to primary ec2 instance, change "primary_instance" to "backup_instance" in order to point at backup ec2 instance + target_id = data.aws_instances.primary_instance.ids[0] + port = each.value.port +}