In Islam, as in the other Abrahamic religions, suicide is considered a grievous sin, worthy of special punishment in the afterlife. As in the other Abrahamic religions, suicide for a worthy cause is excepted.
In the West, one method of attempted punishment avoidance has come to be known as "suicide by cop"
My hypothesis about the lone wolf terrorist attacks that are occurring, recently, perpetrated by disaffected Muslims, is a punishment avoidance method, whereby the attack is part of "jihad", which like the Crusades of old, excused all sorts of atrocities.
This may explain why sometimes there is no claim of responsibility by either ISIS or Al Qaeda; they didn't know about it beforehand. Some young man, decides to end a seemingly unbearable life, and looks for personal salvation by killing the "enemy".