A Trump-appointed US intelligence official has resigned over the Iran war, claiming Iran posed "no imminent threat".