Skip to content

Commit

Permalink
Tribunals: recreate backup ec2 (#9120)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-k1998 authored Dec 17, 2024
1 parent f1ca561 commit b73e046
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions terraform/environments/tribunals/asg-shared.tf
Original file line number Diff line number Diff line change
Expand Up @@ -197,45 +197,45 @@ resource "aws_launch_template" "tribunals-all-lt" {
user_data = filebase64("ec2-shared-user-data.sh")
}

# resource "aws_launch_template" "tribunals-backup-lt" {
# name_prefix = "tribunals-backup"
# image_id = jsondecode(data.aws_ssm_parameter.ecs_optimized_ami.value)["image_id"]
# instance_type = "m5.4xlarge"
# update_default_version = true

# iam_instance_profile {
# name = aws_iam_instance_profile.ec2_instance_profile.name
# }

# block_device_mappings {
# device_name = "/dev/sda1"

# ebs {
# volume_size = 80
# volume_type = "gp2"
# }
# }
# ebs_optimized = true

# network_interfaces {
# device_index = 0
# security_groups = [aws_security_group.cluster_ec2.id]
# subnet_id = data.aws_subnets.shared-public.ids[1]
# delete_on_termination = true
# associate_public_ip_address = true
# }

# tag_specifications {
# resource_type = "instance"
# tags = {
# Environment = local.environment
# Name = "tribunals-backup-instance"
# Role = "Backup"
# }
# }

# user_data = filebase64("ec2-backup-instance-user-data.sh")
# }
resource "aws_launch_template" "tribunals-backup-lt" {
name_prefix = "tribunals-backup"
image_id = jsondecode(data.aws_ssm_parameter.ecs_optimized_ami.value)["image_id"]
instance_type = "m5.4xlarge"
update_default_version = true

iam_instance_profile {
name = aws_iam_instance_profile.ec2_instance_profile.name
}

block_device_mappings {
device_name = "/dev/sda1"

ebs {
volume_size = 80
volume_type = "gp2"
}
}
ebs_optimized = true

network_interfaces {
device_index = 0
security_groups = [aws_security_group.cluster_ec2.id]
subnet_id = data.aws_subnets.shared-public.ids[1]
delete_on_termination = true
associate_public_ip_address = true
}

tag_specifications {
resource_type = "instance"
tags = {
Environment = local.environment
Name = "tribunals-backup-instance"
Role = "Backup"
}
}

user_data = filebase64("ec2-backup-instance-user-data.sh")
}

# # Finally, create the Auto scaling group for the launch template
resource "aws_autoscaling_group" "tribunals-all-asg" {
Expand All @@ -257,18 +257,18 @@ resource "aws_autoscaling_group" "tribunals-all-asg" {
}
}

# 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_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

0 comments on commit b73e046

Please sign in to comment.