diff --git a/services/terraform/remote/aws_ecs.tf b/services/terraform/remote/aws_ecs.tf --- a/services/terraform/remote/aws_ecs.tf +++ b/services/terraform/remote/aws_ecs.tf @@ -36,13 +36,19 @@ } # Autoscaling configuration +resource "aws_iam_instance_profile" "ecs_instance_profile" { + # AWS Console creates profiles with the same name as IAM roles. + # We do the same here. + name = aws_iam_role.ecs_instance_role.name + role = aws_iam_role.ecs_instance_role.name +} resource "aws_launch_template" "ecs_services" { name_prefix = "services-ecs-ec2-" image_id = data.aws_ami.al2_x86_ecs.id instance_type = "t3.small" iam_instance_profile { - name = aws_iam_role.ecs_instance_role.name + name = aws_iam_instance_profile.ecs_instance_profile.name } metadata_options {