title: Fargate oneoff task keeps running
body: <p>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</p>
  <p>this is the task definition :</p>
  <pre><code>resource &quot;aws_ecs_task_definition&quot; &quot;migrate&quot; {
    family                   = &quot;${var.project_name}-${var.environment}-migrate&quot;
    network_mode             = &quot;awsvpc&quot;
    requires_compatibilities = [&quot;FARGATE&quot;]
    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 = &lt;&lt;DEFINITION
    [
     {
        &quot;name&quot;: &quot;${var.project_name}-migrate&quot;,
        &quot;image&quot;: &quot;${var.repository_url}:latest&quot;,
        &quot;cpu&quot;: 512,
        &quot;memory&quot;: 1024,
        &quot;command&quot;: [
          &quot;/bin/sh&quot;,
          &quot;-c&quot;,
          &quot;python manage.py migrate --no-input&quot;
        ],
        &quot;mountPoints&quot;: [],
        &quot;environment&quot;: [
          {
            &quot;name&quot;: &quot;DJANGO_SETTINGS_MODULE&quot;,
            &quot;value&quot;: &quot;****&quot;
          },
          {
            &quot;name&quot;: &quot;DB_HOST&quot;,
            &quot;value&quot;: &quot;****&quot;
          },
          {
            &quot;name&quot;: &quot;DD_API_KEY&quot;,
            &quot;value&quot;: &quot;****&quot;
          }
        ],
        &quot;secrets&quot;: [
          {
            &quot;name&quot;: &quot;SECRETS&quot;,
            &quot;valueFrom&quot;: &quot;*****&quot;
          }
        ],
        &quot;logConfiguration&quot;: {
        &quot;logDriver&quot;: &quot;awslogs&quot;,
        &quot;options&quot;: {
          &quot;awslogs-group&quot;: &quot;****&quot;,
          &quot;awslogs-region&quot;: &quot;****&quot;,
          &quot;awslogs-stream-prefix&quot;: &quot;******&quot;
        }
        },
        &quot;volumesFrom&quot;: []
      }
  
    ]
  DEFINITION
  }
  </code></pre>
  <p>and this is how i call it from github actions</p>
  <pre><code>aws ecs run-task --launch-type FARGATE --cluster cs-name  --task-definition $MIGRATE_TASK_ARN --network-configuration &quot;awsvpcConfiguration={subnets=[${{ secrets.MIGRATE_TASK_SUBNET_IDA }}, ${{ secrets.MIGRATE_TASK_SUBNET_IDB }}],securityGroups=${{ secrets.MIGRATE_TASK_SECURITY_GROUP_ID }}}&quot;
  
  </code></pre>
  <p>any idea what's wrong ?</p>