title: AWS pipeline with cross-account CodeCommit repo as Source
body: <p>I need to create a pipeline with CDK that will trigger a deploy in CloudFormation based on a branch in a CodeCommit repo. If the CodeCommit repo was in the same account as the pipeline, I would use something like:</p>
  <pre class="lang-js prettyprint-override"><code>const codecommitRepo = codecommit.Repository.fromRepositoryName(
    this,
    'AppRepository',
    'REPO_NAME'
  );
  
  pipeline.addStage({
    stageName: 'Source',
    actions: [
      new codepipeline_actions.CodeCommitSourceAction({
        actionName: 'Source',
        repository: codecommitRepo,
        branch: 'BRANCH_NAME',
        output: sourceArtifact,
      }),
    ],
  });
  </code></pre>
  <p>However, what if the CodeCommit repo is in a different account?</p>
  <p>The architecture I'm trying to recreate is similar to the one shown in <a href="https://cloudfornoobs.com/aws-codepipeline-with-cross-account-codecommit-repo/" rel="nofollow noreferrer">this article</a> (image below), but with CDK and CloudFormation.</p>
  <p><a href="https://i.stack.imgur.com/vvoD6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vvoD6.png" alt="aws-architecture" /></a></p>
  <p>How can I create that?</p>