# ArtifactPath

A specific file within an output artifact.

The most common use case for this is specifying the template file
for a CloudFormation action.

- Source: [`aws-codepipeline/lib/artifact.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-codepipeline/lib/artifact.ts#L163)

## Example

```ts
// Source stage: read from repository
const repo = new codecommit.Repository(stack, 'TemplateRepo', {
  repositoryName: 'template-repo',
});
const sourceOutput = new codepipeline.Artifact('SourceArtifact');
const source = new cpactions.CodeCommitSourceAction({
  actionName: 'Source',
  repository: repo,
  output: sourceOutput,
  trigger: cpactions.CodeCommitTrigger.POLL,
});
const sourceStage = {
  stageName: 'Source',
  actions: [source],
};

// Deployment stage: create and deploy changeset with manual approval
const stackName = 'OurStack';
const changeSetName = 'StagedChangeSet';

const prodStage = {
  stageName: 'Deploy',
  actions: [
    new cpactions.CloudFormationCreateReplaceChangeSetAction({
      actionName: 'PrepareChanges',
      stackName,
      changeSetName,
      adminPermissions: true,
      templatePath: sourceOutput.atPath('template.yaml'),
      runOrder: 1,
    }),
    new cpactions.ManualApprovalAction({
      actionName: 'ApproveChanges',
      runOrder: 2,
    }),
    new cpactions.CloudFormationExecuteChangeSetAction({
      actionName: 'ExecuteChanges',
      stackName,
      changeSetName,
      runOrder: 3,
    }),
  ],
};

new codepipeline.Pipeline(stack, 'Pipeline', {
  crossAccountKeys: true,
  stages: [
    sourceStage,
    prodStage,
  ],
});
```

## Initializer

```ts
new ArtifactPath(artifact: Artifact, fileName: string)
```

## Properties

- `artifact`: [Artifact](/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Artifact.html) (required)

- `fileName`: string (required)

- `location`: string (required)

## Methods

- `artifactPath(artifactName: string, fileName: string): ArtifactPath // chainable` (static)
