I’d recommend talking to your GP about it too.
Sometimes suicidal thoughts have a physical cause which can be corrected by just taking a few tablets for a short period of time.
Talking to someone is a good sign though. If you were sure suicide was what you wanted to do you wouldn’t need to talk about it so clearly you have doubts that you need to explore first.