The threat of Russian involvement in Ukraine was known wayyyy ahead of the invasion actually occurring. Ukraine tried hard to join NATO to "deter" it but they never allowed it. So yeah, they don't deter shit.
If Russia had plans to invade Finland like they did Ukraine, we don't know if that would have gotten them into NATO.
They tried to join NATO and they didn't let them. There was a real threat and they chose not to deter it.
Finland wasn't under any threat and was allowed to join, around the same time. The country that actually had a known threat wasn't allowed to join. So they clearly haven't deterred anything.