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: recreate backup ec2 #9120

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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
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
Loading