Diagouraga, who started his career with Watford, will join up with his new team-mates when the players reconvene for pre-season training on July 1.
He told the club's official website: "The ambition that the club showed was first-class and that has persuaded me to join.
"Peterborough are going places and I am pleased to be here. I played against the club for Hereford last season and when the opportunity came about to talk to Peterborough I jumped at the chance.
"I had a very good time at Hereford and I am sad to leave them, but at the end of the day I had to do what is best for me and my career and it is exciting times that I am now a Peterborough player and I can't wait to get started."