It sounded like great news when Carrier said last week that it would invest millions in the Indiana plant it decided to keep in the U.S.

The company's deal with President-elect Donald Trump to keep a furnace plant from moving to Mexico also calls for a $16 million investment in the facility.

But that has a big down side for some of the workers in Indianapolis.

Most of that money will be invested in automation said to Greg Hayes, CEO of United Technologies, Carrier's corporate parent. And that automation will replace some of the jobs that were just saved.

"We're going to...automate to drive the cost down so that we can continue to be competitive," he said on an interview on CNBC earlier this week. "Is it as cheap as moving to Mexico with lower cost labor? No. But we will make that plant competitive just because we'll make the capital investments there. But what that ultimately means is there will be fewer jobs."

The decision to keep Carrier's furnace manufacturing operations in the U.S. instead of moving them to Mexico will save about 800 jobs out of the 1,400 at the plant, at least in the near term. The company declined to say how many of the plants 800 remaining jobs could be lost to automation, or when.

Related: Robots threaten these 8 jobs

The threat that automation poses to jobs a big concern for Chuck Jones, president of United Steelworkers union Local 1999, which represents the Carrier workers.

"Automation means less people," he told CNN's Chris Cuomo on "New Day" on Thursday. "I think we'll have a reduction of workforce at some point in time once they get all the automation in and up and running."

Still, automation is the only way that a plant in Indiana that pays about $20 an hour can compete with Mexican plants where workers earn $3 an hour.

Related: Carrier to raise prices on furnaces and air conditioners

The number of U.S. manufacturing jobs in the U.S. has declined sharply thanks in large part to more efficient factories.

"You can't just blame cheap labor [outside the U.S.]," said Dan Miklovic, principal analyst with LNS research. "Certainly many of the jobs that we've lost, especially in more sophisticated industries, it's not so much that they've been offshored, but it has been automation that replaced them. We use a lot more robots to build cars."

Related: The manufacturing boom Donald Trump ignores

All together, U.S. factories are actually producing more products today than they did in the post-World War II era, according to the Federal Reserve's reading on manufacturing output. Output at U.S. factories is up 150% in last 40 years. But U.S. manufacturing jobs have plunged by more than 30% in that same period. And automation is a big reason why.

And it's not a trend that's going to end with Carrier or even with manufacturers.

A recent study by McKinsey & Co. said that 45% of the tasks that U.S. workers are currently paid to perform can be automated by existing technology. That represents about $2 trillion in annual wages.