Catalyzes the ATP-dependent biosynthesis of glutamine from glutamate and ammonia. ATP + L-glutamate + NH4(+) = ADP + H(+) + L-glutamine + phosphate Binds 2 Mg(2+) ions per subunit. Homooctamer. Two forms of glutamine synthetase (GSII and GSIII) can be found in this nitrogen fixing bacteria, GSII is a typical eukaryotic glutamine synthetase whereas GSIII is a divergent type with very low sequence similarity to the type I and II enzymes. Belongs to the glutamine synthetase family.