Where does it talk about onan in the bible?

The story of Onan is found in the book of Genesis, chapter 25, verses 5-10. Onan's brother, Er (not a typo, his name is "Er") died before being able to impregnate his wife, Tamar. According to early Jewish law, Onan was supposed to impregnate Tamar in order to keep the male lineage moving along.
So, Onan sleeps with Tamar. However, instead of trying to impregnate her, Onan decides to pull out at the last second and "spilled his seed upon the ground" (as the Bible so eloquently puts it).

So God kills Onan for it. The End.

Now, many preachers have pointed to this story and said the spilling of seed was part of the evil; however, most Biblical scholars have interpreted this story as the evil of not following God's laws. Take yer pick.