Nuclear weapon, or the threat of having one, is a reason that Iran and North Korea as still not being invaded.
I would agree with you on North Korea. The only reason why they are still not being invaded is due to the fact that they are having nuclear weapons. But I am not sure about Iran. They are saying that they abandoned their nuclear weapons program. But who knows for sure?