code: def _diff_stack(self, stack, **kwargs):
          
          if self.cancel.wait(0):
              return INTERRUPTED
  
          if not build.should_submit(stack):
              return NotSubmittedStatus()
  
          if not build.should_update(stack):
              return NotUpdatedStatus()
  
          provider = self.build_provider(stack)
  
          provider_stack = provider.get_stack(stack.fqn)
  
          # get the current stack template & params from AWS
          try:
              [old_template, old_params] = provider.get_stack_info(
                  provider_stack)
          except exceptions.StackDoesNotExist:
              old_template = None
              old_params = {}
  
          stack.resolve(self.context, provider)
          # generate our own template & params
          parameters = self.build_parameters(stack)
          new_params = dict()
          for p in parameters:
              new_params[p['ParameterKey']] = p['ParameterValue']
          new_template = stack.blueprint.rendered
          new_stack = normalize_json(new_template)
  
          output = ["============== Stack: %s ==============" % (stack.name,)]
          # If this is a completely new template dump our params & stack
          if not old_template:
              output.extend(self._build_new_template(new_stack, parameters))
          else:
              # Diff our old & new stack/parameters
              old_template = parse_cloudformation_template(old_template)
              if isinstance(old_template, str):
                  # YAML templates returned from CFN need parsing again
                  # "AWSTemplateFormatVersion: \"2010-09-09\"\nParam..."
                  # ->
                  # AWSTemplateFormatVersion: "2010-09-09"
                  old_template = parse_cloudformation_template(old_template)
              old_stack = normalize_json(
                  json.dumps(old_template,
                             sort_keys=True,
                             indent=4,
                             default=str)
              )
              output.extend(build_stack_changes(stack.name, new_stack, old_stack,
                                                new_params, old_params))
          ui.info('\n' + '\n'.join(output))
  
          stack.set_outputs(
              provider.get_output_dict(provider_stack))
  
          return COMPLETE
docs: Handles the diffing a stack in CloudFormation vs our config