Perry, according to U.S. President Donald Trump says however Perry will stay in the job until the end of the year, by which time he will have served two years.

The Trump announcement on Thursday came as a surprise to the nation, but the president says the resignation was no surprise to him.

He said he had known for months Perry, a former governor of Texas and a fellow Republican candidate in the 2016 presidential elections, would quit.

"Rick and I have been talking for six months. In fact, I thought he might go a bit sooner," Mr Trump said Thursday. "But he's got some very big plans. He's going to be very successful. We have his successor. We'll announce it pretty soon."

Deputy Energy Secretary Dan Brouillette is being touted as a possible replacement.

Curiously, earlier this month in response to a story in the media that he would soon resign, Perry the claim, saying emphatically he had no plans to step down.

"It has been a tremendous honor to serve our country in your administration in such a meaningful way," Perry said in his letter of resignation delivered to the president on Thursday.