How far away? Under the joint comprehensive plan of action, JCPOA, assuming that it meets its commitments as well as the other signatories to the agreement, you have a decade. The agreement enables Iran to keep their nuclear option open so that under changed circumstances, whatever these might be within the length of the agreement, or after it ends or if it's extended, it likely gives Iran the ability to go nuclear fairly quickly.
I don't know the details. IEA and U.S. Intelligence would have a better idea, but I would guess, and it's just a guess, probably about a year if it needed to, given the foundation it's already built for itself.
I don't want everyone to think a massive threat is coming out of the Middle East, but the second key issue is projected down the road. In part, it's not just Iran, but if Iran does this, what will everyone else do in the region? That's where a greater threat starts to emerge as everyone else, not just the Israelis but the Saudis and others, respond to this new threat environment.
The real issue is their ballistic missile development program, which has certainly reached into the intermediate range. It's not operationally deployed, but it could bring all of Europe pretty well under threat. Then from there, the step forward, which won't be that difficult a step to make, would be to go to an ICBM capability. That may be the one that will eventually kill the agreement, because conditions are attached to the agreement with regard to their ballistic missile developments.