I'm having an issue with a fargate one off task , it's meant to run database migration and then stop but it keeps stuck in running status
this is the task definition :
resource "aws_ecs_task_definition" "migrate" {
family = "${var.project_name}-${var.environment}-migrate"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = 512
memory = 1024
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
task_role_arn = aws_iam_role.ecs_task_execution_role.arn
container_definitions = <<DEFINITION
[
{
"name": "${var.project_name}-migrate",
"image": "${var.repository_url}:latest",
"cpu": 512,
"memory": 1024,
"command": [
"/bin/sh",
"-c",
"python manage.py migrate --no-input"
],
"mountPoints": [],
"environment": [
{
"name": "DJANGO_SETTINGS_MODULE",
"value": "****"
},
{
"name": "DB_HOST",
"value": "****"
},
{
"name": "DD_API_KEY",
"value": "****"
}
],
"secrets": [
{
"name": "SECRETS",
"valueFrom": "*****"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "****",
"awslogs-region": "****",
"awslogs-stream-prefix": "******"
}
},
"volumesFrom": []
}
]
DEFINITION
}
and this is how i call it from github actions
aws ecs run-task --launch-type FARGATE --cluster cs-name --task-definition $MIGRATE_TASK_ARN --network-configuration "awsvpcConfiguration={subnets=[${{ secrets.MIGRATE_TASK_SUBNET_IDA }}, ${{ secrets.MIGRATE_TASK_SUBNET_IDB }}],securityGroups=${{ secrets.MIGRATE_TASK_SECURITY_GROUP_ID }}}"
any idea what's wrong ?