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

Performance Hub - SSM AMI param #8405

Merged
merged 3 commits into from
Oct 23, 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
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