Use ResourceDefinition in autoscaling

Compare resources using ResourceDefinition objects (which are both
comparable and hashable, and are independent of any one template format)
instead of passing around snippets of a template.

Change-Id: I3bb8bcd2ff54a699a901aac435a56b537d99e992
Merge "Use ResourceDefinition in autoscaling"