It was a Dianoga:
Dianoga were large cephalopods, capable of growing up to ten meters in length, though most specimens grew to approximately five or six meters. They had a single eyestalk protruding from their mollusk-like bodies, and seven suckered tentacles surrounding a fanged maw containing a sharp serrated probe.
And the reference of the creature attacking Luke on the Death Star trash compactor:
One dianoga was known to have boarded the first Death Star, and made its home in one of the space station's garbage compactors. When Luke Skywalker, Han Solo and Chewbacca were forced into the trash compactor during the rescue of Leia Organa, the dianoga attacked Skywalker. It pulled the young farmboy under the murky, polluted water, but was scared away when the compactor walls activated. The dianoga itself had managed to burrow into the wall, and so was relatively safe inside the compactor; that is, until the Death Star was destroyed.