Yes Rama had killed Shambhuka because he was performing ascetic penance to become God in the same human body of his and was desirous of attaining celestial powers which could have been risk for Gods. It is mentioned in Uttara Kanda of Valmiki Ramayana. 

From [Valmiki Ramayana, Uttara Kanda, Chapter 75-76](https://archive.org/details/The.Ramayana.of.Valmiki.by.Hari.Prasad.Shastri/page/n1583/mode/2up), When Rama asked him why he is performing such ascetic penance:

> HEARING the words of Rama of imperishable exploits, that ascetic, his head still hanging downwards, answered :

> O Rama, I was born of a Shudra alliance and I am performing this rigorous penance in order to acquire the status of a God in this body. I am not telling a lie, O Rama, I wish to attain the Celestial Region. Know that I am a Shudra and my name is Shambuka."

> As he was yet speaking, Raghava, drawing his brilliant and stainless sword from in scabbard, cut off his head.