ALVARADO, Texas – U.S. Energy Secretary Rick Perry, the former Texas governor who has faced scrutiny over President Donald Trump's interactions with Ukraine, is resigning.

Perry reportedly informed the president on Thursday as the two flew together on Air Force One to Texas, where Trump is holding several events, including a political rally in Dallas. The president confirmed the news while traveling in the state.

"He’s done a phenomenal job," Trump told supporters at the rally. "He’s going to be leaving at the end of the year."

Trump said earlier Thursday that he had a replacement in mind for the job would announce that person soon.

In a resignation letter released by the Department of Energy late Thursday, Perry touted U.S. energy independence – hitting a common refrain raised by Trump.

"Not long ago, America was an importer of energy," Perry wrote. "Now, the U.S. private sector is leading the world in energy production, exploration and exports."

A member of Trump's original Cabinet, Perry has come under scrutiny amid the ongoing impeachment inquiry into whether Trump abused his office by pressuring Ukraine to help to dig up dirt on Joe Biden, one of his top political rivals.

Perry was subpoenaed last week in the inquiry. House Democrats have demanded he turn over documents related to Trump's call with Ukrainian President Volodymyr Zelensky, during which Trump pushed for an investigation of Biden and Biden's son Hunter, who once had business interests in Ukraine.

Perry had led the U.S. delegation to Zelensky's inauguration in May.

House Democrats had also asked for information related to media reports about Perry's attempt to changethe management structure at a Ukrainian energy firm in a way that could have benefited officials working with Trump's personal attorney, Rudy Giuliani.

Perry, who served a record 14 years as Texas governor, ran unsuccessfully for president in both 2012 and 2016, when he was a rival to Trump. As Trump was planning his first trip to the border of his candidacy, Perry slammed the former reality TV host turned presidential candidate.

"He offers a carnival act that can best be described as Trumpism," Perry said in a July 2015 speech. "A toxic mix of demagoguery and mean-spiritedness and nonsense that will lead the Republican Party to perdition.

"Let no one be mistaken: Donald Trump's candidacy is a cancer on conservatism."

But Perry ultimately set aside his earlier misgivings and backed Trump in the general election.