Naya Rivera had an abortion while starring on “Glee.”

The 29-year-old actress opens up about her decision to terminate her 2010 pregnancy in her forthcoming memoir, “Sorry Not Sorry.”

According to an excerpt on People, Rivera didn’t tell her then-boyfriend Ryan Dorsey she was pregnant and underwent the procedure on a day off from filming the hit show.

Rivera and Dorsey, 33, eventually tied the knot in 2014. In 2015, they welcomed their now 11-month-old son, Josey.

But an unplanned pregnancy wasn’t Rivera’s only hurdle. She also recounts suffering from anorexia.

“By the time I was a sophomore, I started feeling that what had begun as a game had maybe gone too far,” she writes. “I just avoided food at all costs. If my mom had packed a lunch for me, I’d either trash it or find some excuse to give it away.”

She recalls a time when she was so hungry, Rivera began to shake, so she decided to eat an apple.

“I just sat there and held it up to my mouth,” she details. “It was like the two sides of my brain competing, one telling me to ‘eat it, it’s just an apple,’ and the other telling me, ‘no, no, no — that’ll ruin everything.’”

While she says she overcame her eating disorder by graduation, other body issues remained. Using money she saved from acting jobs, Rivera underwent breast augmentation surgery at age 18.

“My new boobs were a confidence thing, not a sexual thing,” Rivera explains. “People have a lot of opinions about plastic surgery, but more than ten years after I got my boobs, they still make me happy when I look in the mirror. It might have been the best $8K I’ve ever spent.”

“I’ve done a lot of living,” she added. “I’m a 79-year-old trapped in a 29-year-old’s body.”

“Sorry Not Sorry” hits stores on September 13.

This article originally appeared in the New York Post's Page Six.