It was mixed. The USSR was more closely aligned with Iraq over the years. The Soviets, like the US, were primarily interested in expanding their influence during the Cold War. The Iranian Revolution provided an opportunity; the country had previously been a key American ally that provided a bulwark against the spread of Soviet influence in the region. But things did not quite work out as the USSR would have liked. Iran was anti-communist, and the USSR came to view them as a potential detriment to Soviet interests.
The regime change in 1979 had a major effect on the region. There were fears of a revolutionary wave breaking out among emboldened Shi'ite populations, particularly in Shi'ite-majority countries like Iraq and Bahrain, whose governments (though very different) were headed by a Sunni minority. This fear was one of Saddam Hussein's motives for invading Iran in 1980. The possibility of a revolutionary wave also worried the Soviets.
The USSR opposed the Iran-Iraq War (1980-1988) and did not want to take sides, hoping to maintain ties with Iraq without alienating Iran. The war had some proxy elements, with foreign states offering military aid to either side. At first, the Soviets did supply the Iranians with some military aid.
After a while, Iran looked poised to win the war and sought to remove Saddam. The Soviets had failed to gain much influence with the country, and didn't want to lose Iraq as an ally. They ultimately became one of Iraq's biggest suppliers of aid, and the war dragged on. All of this, coupled with Saddam's use of chemical weapons and the atrocities he committed during the war, caused significant enmity between the Soviet Union and Iran that would last until the USSR's dissolution in 1991.
Iran was helping train anti-Soviet mujaheddin in Afghanistan. Several large factions were HQ'd in Iran at the time. The Iranians had a revolutionary slogan of "Neither East Nor West" which decorates the entryway of their Foreign Ministry, which references Iran's position in the Cold War