The one thing nobody has mentioned is the Iran-US angle. US should understand from their observation in Ukraine that Iran will be far harder to crack in an invasion than they used to think and indeed, a ground attack might end in political failure due to excessive casualties.
1. In Ukraine, the terrain is flat. This means airpower has an advantage of being able to more or less see everything from altitude and command planes can maintain datalink with troops easily. Iran is as mountainous as Afghanistan but with the difference that their cities are actually in the mountains, not the flat desert in a ring around the mountains (see map of Afghanistan). E-8s circling in the Persian Gulf or over Turkey would not have line of sight in much of the valleys of the Zagaros Mountains at the Iranian border.
2. Russia has to keep forces in reserve for a NATO intervention much like US can't use their full force against Iran today, unlike Iraq in 1991 and 2003 because now they need to worry about a European or Southeast Asian escalation from Russia or China. So you can really only consider CENTCOM and some forces in CONUS. This limits the possible scope of an attack.
3. ATGMs, MANPADs and drones are devastating even in flat terrain with minor cover like forest. In mountain terrain, they're even more devastating because of line of sight limitations and ability of defenders to hhave an altitude advantage. Most of all, mid sized drones like TB-2 are not range limited by fuel, they're range limited by command signal line of sight. With a command trailer hidden in some mountain top forest, the range in the valleys can be extended greatly.
4. The buildup of forces in flat, rural terrain is easily visible. Iran would be able to mobilize in time.
5. The red line of attacking NATO or Russian forces directly is holding. That means Iran has a guaranteed supply line through Caspian Sea where they will refrain from attacking Russian cargo ships dropping off Kornet ATGMs. Iran also produces it's own ATGMs.
6. Logistics train matters. One reason why Afghanistan was even doable was with Russia and Pakistan agreeing to open airspace. Russia will not do that for Iran. I doubt Pakistan would. Iraq might depending on how things go but probably not. That means Saudi Arabia, Turkey and the Gulf are the only viable attack routes. They'd have to sustain an invasion into the mountains almost straight after entering the border. There's no way to bypass and encircle the Iranian Army like the Thunder Run in Iraq 2003.
7. Size matters. Ukraine is not some tiny minor European kingdom, it is a huge country of 40 million people on 600k square km of flat farmlands and forest. Iran has 90 million people in 1600k square km of mountain.
8. Motivation is highly important. Ukraine has GDP per Capita of 4000 USD. Iran has GDP per Capita of 10000 USD and they're devoutly religious. They have far more motivation to resist both for material and ideological reasons. Russians thought Ukrainians would crumble mentally on contact. Iran is definitely not going to crumble on contact, they've been waiting 43 years and counting for this possibility.
Conclusion: Iran is a much, much tougher cookie than Ukraine so despite the greater capability of the US, they're still going to be extremely difficult to crack.