Apple is planning to spend $2 billion to convert the factory that GT Advanced Technologies once used to produce sapphire into a massive data center. The investment will create upwards of 500 construction jobs and once complete, the 1.3 million-square-foot facility will be powered entirely by renewable energy.

The Cupertino-based company is trying to make the best out of a bad situation. The facility, a former solar-panel factory, was originally purchased by Apple in 2013 and outfitted with equipment that GT Advanced Technologies was to use to produce large quantities of sapphire.

The sapphire was going to be used for the screens on the iPhone 6 and iPhone 6 Plus but that plan was scrapped when it became clear that GT Advanced couldn't produce the quality of sapphire they had agreed upon.

All said and done, Apple only received 10 percent of the sapphire it was supposed to. GT Advanced, meanwhile, filed for bankruptcy last October.

Construction is slated to begin in 2016 which will give GT Advanced plenty of time to remove its equipment from the site. The facility will employ 150 full-time Apple staff and will serve as a command center for the company's global network of data centers.

At $2 billion, it's one of the largest investments Apple has ever made (not counting the $1 billion that Apple has already invested in the site for GT Advanced).