Trump was elected to fulfill his promises. This was one of them.
He changed his tune after the predictable howls from the other GOP candidates like Marco Rubio and Lindsey Graham who are in Washington to represent the interests of their foreign handlers.