What must you do to have eternal life? First ask the question, listen for the answer, and then do whatever Jesus tells you to do!
Jesus was setting out on His journey when a man knelt before Him and asked Jesus what he had to do to inherit eternal life?
Mark 10:17 And as He was setting out on His journey, a man ran up and knelt before Him and asked Him, Teacher, [You are essentially and perfectly morally] good, what must I do to inherit eternal life [that is, to partake of eternal salvation in the Messiah’s kingdom]? 18 And Jesus said to him, Why do you call Me [essentially and perfectly morally] good? There is no one [essentially and perfectly]morally] good—except God alone.19 You know the commandments: Do not kill, do not commit adultery, do not steal, do not bear false witness, do not defraud, honor your father and mother.20 And he replied to Him, Teacher, I have carefully guarded and observed all these and taken care not to violate them from my boyhood.21 And Jesus, looking upon him, loved him, and He said to him, You lack one thing; go and sell all you have and give [the money] to the poor, and you will have treasure in heaven; and come [and] accompany Me [walking the same road that I walk]. 22 At that saying the man’s countenance fell and was gloomy, and he went away grieved and sorrowing, for he was holding great possessions. AMPC
First —the man already knew He wasn't right with God —and that's a good thing. I make mention of that because many don't acknowledge that they should question if they are right with Jesus, they only assume. That stance is one of a distance from God. If you assume without asking —are you as one of those who assumed they were good with Jesus?
Matthew 7:21 Not everyone who says to Me, Lord, Lord, will enter the kingdom of heaven, but he who does the will of My Father Who is in heaven. 22 Many will say to Me on that day, Lord, Lord, have we not prophesied in Your name and driven out demons in Your name and done many mighty works in Your name? 23 And then I will say to them openly (publicly), I never knew you; depart from Me, you who act wickedly [disregarding My commands]. AMPC
If we already know that we are not right with Jesus then it is because we are following Him and are seeking correction. If we know we are not perfect —like Him, it is because we know as many admit, we haven't arrived.
Although the man wanted to be right with Jesus, he let his flesh get in the way. He was tender toward the Lord —as many of us are, but when he heard Jesus tell him his stuff was in the way, and he had a call on his life —he hardened his heart and walked away.
We know he was tender toward the Lord —he said that. He said all his life he followed the law. What he was saying is (he thought) he was good and being good was the key to eternal life.
Many tell me they have a good heart, and that makes them good —ready for heaven. Being good then is their thinking that allows them eternal life. But, Jesus didn't say that. In fact Jesus said no one is good except the Father (Mark 10:18).
Oftentimes we think we are right with God as did this man. Although he asked, he knew deep down something was wrong, I think at the same time he was hoping Jesus would recognize him as being a —good person. I don't think he expected Jesus to say —give your stuff away and follow Me. Although I am sure he did know about his stuff, he didn't expect that it was such a big problem (as we think) that he should give it all away.
Many times we know deep down something is not right, but it just seems easier to say —God understands, it's not that bad, I'm good. He knows —I have a good heart. I think I am a good person, I am sure I am fine.
Check out your status with Jesus. Don't assume you are a good Christian — a good person and that will suffice. Don't reject that deep knowing that something is not quite right. Then, don't let it stop you from checking in with Jesus. Lastly, when He tells you what is not right, don't harden your heart. Don't give up eternal life for a piece of cake, if that be your god.