# VariableProps

Properties of pipeline-level variable.

Extends: VariableProps
Used as props by: Variable

- Source: [`aws-codepipeline/lib/variable.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-codepipeline/lib/variable.ts#L9)
- Type last changed: v2.128.0 · 14 Feb 2024

## Example

```ts
declare const sourceAction: codepipeline_actions.S3SourceAction;
declare const sourceOutput: codepipeline.Artifact;
declare const deployBucket: s3.Bucket;

// Pipeline-level variable
const variable = new codepipeline.Variable({
  variableName: 'bucket-var',
  description: 'description',
  defaultValue: 'sample',
});

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  variables: [variable],
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Deploy',
      actions: [
        new codepipeline_actions.S3DeployAction({
          actionName: 'DeployAction',
          // can reference the variables
          objectKey: `${variable.reference()}.txt`,
          input: sourceOutput,
          bucket: deployBucket,
        }),
      ],
    },
  ],
});
```

## Properties

- `defaultValue`: string — The default value of a pipeline-level variable.

  **Default:** No default value.

- `description`: string — The description of a pipeline-level variable.

  **Default:** No description.

  It's used to add additional context
  about the variable, and not being used at time when pipeline executes.

- `variableName`: string (required) — The name of a pipeline-level variable.
