VariableProps

class aws_cdk.aws_codepipeline.VariableProps(*, variable_name, default_value=None, description=None)

Bases: object

Properties of pipeline-level variable.

Parameters:
  • variable_name (str) – The name of a pipeline-level variable.

  • default_value (Optional[str]) – The default value of a pipeline-level variable. Default: - No default value.

  • description (Optional[str]) – The description of a pipeline-level variable. It’s used to add additional context about the variable, and not being used at time when pipeline executes. Default: - No description.

ExampleMetadata:

infused

Example:

# source_action: codepipeline_actions.S3SourceAction
# source_output: codepipeline.Artifact
# deploy_bucket: s3.Bucket


# Pipeline-level variable
variable = codepipeline.Variable(
    variable_name="bucket-var",
    description="description",
    default_value="sample"
)

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    variables=[variable],
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Deploy",
        actions=[
            codepipeline_actions.S3DeployAction(
                action_name="DeployAction",
                # can reference the variables
                object_key=f"{variable.reference()}.txt",
                input=source_output,
                bucket=deploy_bucket
            )
        ]
    )
    ]
)

Attributes

default_value

The default value of a pipeline-level variable.

Default:
  • No default value.

description

The description of a pipeline-level variable.

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

Default:
  • No description.

variable_name

The name of a pipeline-level variable.