We construct from first principles the operators (A) over cap (M) that annihilate the partition functions (or waveffinctions) of three-dimensional Chern-Simons theory with gauge groups SU(2), SL(2,R), or SL(2, C) on knot complements M. The operator (A) over cap (M) is a quantization of a knot complement's classical A-polynomial A(M) (l, m). The construction proceeds by decomposing three-manifolds into ideal tetrahedra, and invoking a new, more global understanding of gluing in topological quantum field theory to put them back together. We advocate in particular that, properly interpreted, "gluing = symplectic reduction." We also arrive at a new finite-dimensional state integral model for computing the analytically continued "holomorphic blocks" that compose any physical Chern-Simons partition function.