code: func fixResourceCountSetTransition(ctx EvalContext, addr addrs.AbsResource, countEnabled bool) {
  	state := ctx.State()
  	changed := state.MaybeFixUpResourceInstanceAddressForCount(addr, countEnabled)
  	if changed {
  		log.Printf("[TRACE] renamed first %s instance in transient state due to count argument change", addr)
  	}
  }
docs: // fixResourceCountSetTransition is a helper function to fix up the state when a
  // resource transitions its "count" from being set to unset or vice-versa,
  // treating a 0-key and a no-key instance as aliases for one another across
  // the transition.
  //
  // The correct time to call this function is in the DynamicExpand method for
  // a node representing a resource, just after evaluating the count with
  // evaluateResourceCountExpression, and before any other analysis of the
  // state such as orphan detection.
  //
  // This function calls methods on the given EvalContext to update the current
  // state in-place, if necessary. It is a no-op if there is no count transition
  // taking place.
  //
  // Since the state is modified in-place, this function must take a writer lock
  // on the state. The caller must therefore not also be holding a state lock,
  // or this function will block forever awaiting the lock.