I added a launch template to IaC and and when I run the batch job it stuck in runnable state
this my launch template code :
resource "aws_launch_template" "conversion_launch_template" {
name = "conversion-launch-template"
block_device_mappings {
device_name = "/dev/sda1"
ebs {
volume_size = 80
}
}
iam_instance_profile {
name = "conversion-pipeline-batch-iam-instance-profile"
}
}
and in "aws_batch_compute_environment" resource I reference the launch template inside the compute ressource block :
resource "aws_batch_compute_environment" "conversion_pipeline" {
compute_environment_name = "conversion-pipeline-batch-compute-environment"
compute_resources {
instance_role = aws_iam_instance_profile.conversion_pipeline_batch.arn
instance_type = var.conversion_pipeline_instance_type
max_vcpus = var.conversion_pipeline_max_vcpus
min_vcpus = 0
security_group_ids = [
aws_security_group.conversion_pipeline_batch.id
]
subnets = var.subnets
type = "EC2"
launch_template {
launch_template_id = aws_launch_template.conversion_launch_template.id
}
}
service_role = aws_iam_role.conversion_pipeline_batch_service_role.arn
type = "MANAGED"
tags = {
environment = var.env
}
}