code: func (mtask *managedTask) applyResourceState(resource taskresource.TaskResource,
  	nextState resourcestatus.ResourceStatus) error {
  	resName := resource.GetName()
  	resStatus := resource.StatusString(nextState)
  	err := resource.ApplyTransition(nextState)
  	if err != nil {
  		seelog.Infof("Managed task [%s]: error transitioning resource [%s] to [%s]: %v",
  			mtask.Arn, resName, resStatus, err)
  		return err
  	}
  	seelog.Debugf("Managed task [%s]: transitioned resource [%s] to [%s]",
  		mtask.Arn, resName, resStatus)
  	return nil
  }
docs: // applyResourceState moves the resource to the given state by calling the
  // function defined in the transitionFunctionMap for the state