From 3ef85d4c66cb7266c21c0b7ee314540122b5a22b Mon Sep 17 00:00:00 2001 From: Mateusz Kolakowski Date: Mon, 16 Dec 2024 17:12:05 +0000 Subject: [PATCH] Tribunals: Temporarily delete ec2 and tg attachment (#9098) --- .../environments/tribunals/asg-shared.tf | 62 +++++++++---------- .../environments/tribunals/load_balancer.tf | 14 ++--- .../tribunals/load_balancer_sftp.tf | 14 ++--- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/terraform/environments/tribunals/asg-shared.tf b/terraform/environments/tribunals/asg-shared.tf index b6eaf67cef0..43768300dde 100644 --- a/terraform/environments/tribunals/asg-shared.tf +++ b/terraform/environments/tribunals/asg-shared.tf @@ -238,37 +238,37 @@ resource "aws_launch_template" "tribunals-backup-lt" { } # # Finally, create the Auto scaling group for the launch template -resource "aws_autoscaling_group" "tribunals-all-asg" { - vpc_zone_identifier = [data.aws_subnet.public_subnets_a.id] - desired_capacity = 1 - max_size = 1 - min_size = 1 - name = local.app_name - - launch_template { - id = aws_launch_template.tribunals-all-lt.id - version = "$Latest" - } - - tag { - key = "Name" - value = "tribunals-instance" - propagate_at_launch = true - } -} - -resource "aws_instance" "tribunals_backup" { - launch_template { - id = aws_launch_template.tribunals-backup-lt.id - version = "$Latest" - } - - tags = { - Environment = local.environment - Name = "tribunals-backup-instance" - Role = "Backup" - } -} +# resource "aws_autoscaling_group" "tribunals-all-asg" { +# vpc_zone_identifier = [data.aws_subnet.public_subnets_a.id] +# desired_capacity = 1 +# max_size = 1 +# min_size = 1 +# name = local.app_name + +# launch_template { +# id = aws_launch_template.tribunals-all-lt.id +# version = "$Latest" +# } + +# tag { +# key = "Name" +# value = "tribunals-instance" +# propagate_at_launch = true +# } +# } + +# resource "aws_instance" "tribunals_backup" { +# launch_template { +# id = aws_launch_template.tribunals-backup-lt.id +# version = "$Latest" +# } + +# tags = { +# Environment = local.environment +# Name = "tribunals-backup-instance" +# Role = "Backup" +# } +# } ########################################################################### diff --git a/terraform/environments/tribunals/load_balancer.tf b/terraform/environments/tribunals/load_balancer.tf index 2c1237b611e..7d61f760154 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 6d61d386a73..e96962cf2c5 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 +# }