The covariant formulation of f(T) gravity