Sounds like the movie Starship Troopers.
That lame, ridiculous movie was only loosely based on the excellent novel by the same name. Yes, the Heinlein story referenced herein is Starship Troopers. I encourage you to read the book. It is short, but potent. Much food for thought.
The movie is a pale shadow of the book. A very pale shadow.