Repsol, Spain's largest oil company, is investing $4.2 billion in a data center project as part of a diversification strategy.