The iron cobra first appeared in the Fiend Folio. The entry and stats are a mess, though. Let's take a look (These images were found on the web. I'm sure they are property of WotC, and only used here for comparative purposes):
As you can see, the description is all over the place. Why do they list who invented it (but, not actually?) Why are there only a dozen in existence? It can be a guard? Or assassin? So glad I had a book to tell me that. And how in the F*%$ do these things track by "psychic vibrations" when they a) don't have psionic abilitiy and b) aren't even alive?
The image above is from the awesome Tome of Horrors by Frog God Games, S&W version. As you can see, modern design has cleaned up the Iron Cobra a lot. All of the good information is there, without phantom psionics.
The iron cobra has an appearance in 1,2,3 and 4e D&D versions. In 5e it shows up in Mordenkainen's Tome of Foes. The only encounter I remember of an iron cobra was in The Sentinal (UK2.) There it was used to guard a library. Although, it looks like there are more. I just found Adventure Lookup.
I modify iron cobras slightly in my game. Their raw materials are 2000 gp worth of gems. Rubies need to be used for the eyes (to give the evil look.) 10 additional gems (all of the same type) must be implanted down the "spine" to conduct the magical energy for locomotion.
(From my playtest of Mord Mar a couple of weeks ago:) In a secret room on a lord's manor, an evil temple hums with power. Its guardian, an iron cobra, stays inert until a living creature touches the altar, at which time it snaps to life and attacks.
The party recently defeated Lareth, the beautiful, the evil cleric of Lloth! With his dying breath he states the command word of his iron cobra. It follows the party back to the tavern, waits for them to be comfortably asleep, and attacks the armorless cleric!
Jackal, an evil fighter fell to ghouls. As his unliving eyes flickered open, his two thoughts were flesh and his beloved cobra treasure. Now, he and his iron cobra hunt the town in the darkness, retreating to the sewers before the sun rises. The town is baffled why some family members disappear, and others are found dead with apparent snake bites. The mayor is sure the snake-men from the swamp are responsible.
A rogue iron cobra wanders the sewers of Redstone, its venom sacs long empty. It attacks any living thing within its eyesight. The leadership of the town knows of it, and leave it alone because it kills so many rats.
At the bottom of a wishing well an iron cobra lies inert. It was placed there a century ago by an evil wizard (now lich.) He promised revenge on the group who thwarted his first attempt at immortality, and now he moves toward the city, ready to awaken his pet, and kill the heroes' kin.