It has been bedrock since the late 1940s that under Article 5 of the NATO Treaty):
The Parties [members of NATO] agree that an armed attack against one or more of them in Europe or North America shall be considered an attack against them all and consequently they agree that, if such an armed attack occurs, each of them, in exercise of the right of individual or collective self-defence recognised by Article 51 of the Charter of the United Nations, will assist the Party or Parties so attacked by taking forthwith, individually and in concert with the other Parties, such action as it deems necessary, including the use of armed force, to restore and maintain the security of the North Atlantic area.
So, Trump’s threat back over the summer to not help some countries would be a direct violation of our obligation under international law.
Moreover, under Article 8:
Each Party declares that none of the international engagements now in force between it and any other of the Parties or any third State is in conflict with the provisions of this Treaty, and undertakes not to enter into any international engagement in conflict with this Treaty.
Now the Trump bromance with Putin requires us to remember that we are still bound by these treaty obligations, and many would argue that they can not be abrogated without the formal treaty process being followed in the US senate (I do not believe that this issue has been tested).
In any event the two top quoted articles would appear to put very serious limits on what Trump can do, at least with respect to NATO members. While Ukraine is not in NATO, the language of the Treaty would oblige the US to come to the help of any NATO member whose country, or forces in or over any NATO county, were attacked including in response to intervention in Ukraine.
So, NATO, unless withdrawn from, prohibits Trump from “enter[ing] into any international engagement in conflict with this Treaty, ” which given the breadth of the common defense language, would appear to be a very significant limitation, since it prohibits any limitation on our prior assistance obligations.
Some might find sadness and an underlining of our pending abandonment of the international leadership in Article 13, which gives a special role to the US in the recording of renunciations of the Treaty: ” . . . any Party may cease to be a Party one year after its notice of denunciation has been given to the Government of the United States of America, which will inform the Governments of the other Parties of the deposit of each notice of denunciation.“) Some might also argue that the language above means that the US is so central to the operation of NATA that it, and it alone, cannot withdraw from it.
While Trump and Putin would attempt to obfuscate every aspect of fact and law, it is hard not be believe that failure to comply with these obligations would be viewed by enough even Republicans to trigger an immediate impeachment or Twenty Fifth Amendment process.