Skip to content
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

Tribunals: Temporarily delete ec2 and tg attachment #9098

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
62 changes: 31 additions & 31 deletions terraform/environments/tribunals/asg-shared.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
# }
# }

###########################################################################

Expand Down
14 changes: 7 additions & 7 deletions terraform/environments/tribunals/load_balancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
14 changes: 7 additions & 7 deletions terraform/environments/tribunals/load_balancer_sftp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
# }
Loading