We study an infinite horizon discrete time optimization problem of the Bolza type. It is argued that this problem arises frequently in models of resource management. In the convex case we obtain a characterization of optimality which is a discrete time stochastic analogue of the Euler equation. Under additional assumptions we prove that all optimal trajectories converge to a unique distribution irrespective of starting point.