aws-cdk-lib.pipelines.StackOutputReference

class StackOutputReference

LanguageType name
.NETAmazon.CDK.Pipelines.StackOutputReference
Gogithub.com/aws/aws-cdk-go/awscdk/v2/pipelines#StackOutputReference
Javasoftware.amazon.awscdk.pipelines.StackOutputReference
Pythonaws_cdk.pipelines.StackOutputReference
TypeScript (source)aws-cdk-lib » pipelines » StackOutputReference

A Reference to a Stack Output.

Example

class MyLambdaStep extends pipelines.Step implements pipelines.ICodePipelineActionFactory {
  private stackOutputReference: pipelines.StackOutputReference

  constructor(
    private readonly fn: lambda.Function,
    stackOutput: CfnOutput,
  ) {
    super('MyLambdaStep');
    this.stackOutputReference = pipelines.StackOutputReference.fromCfnOutput(stackOutput);
  }

  public produceAction(stage: codepipeline.IStage, options: pipelines.ProduceActionOptions): pipelines.CodePipelineActionFactoryResult {

    stage.addAction(new cpactions.LambdaInvokeAction({
      actionName: options.actionName,
      runOrder: options.runOrder,
      // Map the reference to the variable name the CDK has generated for you.
      userParameters: {stackOutput: options.stackOutputsMap.toCodePipeline(this.stackOutputReference)},
      lambda: this.fn,
    }));

    return { runOrdersConsumed: 1 };
  }

  /**
   * Expose stack output references, letting the CDK know
   * we want these variables accessible for this step.
   */
  public get consumedStackOutputs(): pipelines.StackOutputReference[] {
    return [this.stackOutputReference];
  }
}

Properties

NameTypeDescription
outputNamestringOutput name of the producing stack.
stackDescriptionstringA human-readable description of the producing stack.

outputName

Type: string

Output name of the producing stack.


stackDescription

Type: string

A human-readable description of the producing stack.

Methods

NameDescription
isProducedBy(stack)Whether or not this stack output is being produced by the given Stack deployment.
static fromCfnOutput(output)Create a StackOutputReference that references the given CfnOutput.

isProducedBy(stack)

public isProducedBy(stack: StackDeployment): boolean

Parameters

  • stack StackDeployment

Returns

  • boolean

Whether or not this stack output is being produced by the given Stack deployment.


static fromCfnOutput(output)

public static fromCfnOutput(output: CfnOutput): StackOutputReference

Parameters

  • output CfnOutput

Returns

  • StackOutputReference

Create a StackOutputReference that references the given CfnOutput.