Iran's top diplomat Mohammad Javad Zarif has announced his resignation on Instagram in a shock move that came as his country's feud with the United States deepened.