Skip to content

Commit

Permalink
Merge pull request #8405 from ministryofjustice/performance-hub/ssm-a…
Browse files Browse the repository at this point in the history
…mi-param

Performance Hub - SSM AMI param
  • Loading branch information
jemnery authored Oct 23, 2024
2 parents a8a710b + 8a347d8 commit 30817e6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions terraform/environments/performance-hub/module/ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ data "aws_lb_target_group" "target_group" {
}
}

data "aws_ssm_parameter" "ecs_optimized_ami" {
name = "/aws/service/ami-windows-latest/Windows_Server-2019-English-Full-ECS_Optimized"
}

resource "aws_autoscaling_group" "cluster-scaling-group" {
vpc_zone_identifier = sort(data.aws_subnets.shared-private.ids)
desired_capacity = var.ec2_desired_capacity
Expand Down Expand Up @@ -99,13 +95,12 @@ resource "aws_security_group" "cluster_ec2" {
}

# EC2 launch template - settings to use for new EC2s added to the group
# Note - when updating this you will need to manually terminate the EC2s
# Note - to force a new AMI you will need to manually terminate the EC2s
# so that the autoscaling group creates new ones using the new launch template

resource "aws_launch_template" "ec2-launch-template" {
name_prefix = "${var.app_name}-ec2-launch-template"
#image_id = var.ami_image_id
image_id = jsondecode(data.aws_ssm_parameter.ecs_optimized_ami.value)["image_id"]
image_id = "resolve:ssm:/aws/service/ami-windows-latest/Windows_Server-2019-English-Full-ECS_Optimized/image_id"
instance_type = var.instance_type
key_name = var.key_name
ebs_optimized = true
Expand Down

0 comments on commit 30817e6

Please sign in to comment.