Yes, Iran’s problem was they didn’t develop nuclear weapons.
The lesson all countries will take from Ukraine, Iran, and North Korea is: develop nuclear weapons.
Ukraine and Iran both don’t have nuclear weapons and they were both attacked by countries that do. North Korea does have them and they are apparently in no danger of being attacked.