Skip to content
v2.275.0

StackOutputReference Class ​

A Reference to a Stack Output.

Example ​

ts
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 ​

outputNamestringoutput_namestroutputNameStringOutputNamestringOutputName*string#
Output name of the producing stack.
stackDescriptionstringstack_descriptionstrstackDescriptionStringStackDescriptionstringStackDescription*string#
A human-readable description of the producing stack.

Methods ​

fromCfnOutput(output: CfnOutput): StackOutputReference // chainable@staticmethod def from_cfn_output(output: CfnOutput) -> StackOutputReferencepublic static StackOutputReference fromCfnOutput(CfnOutput output)public static StackOutputReference FromCfnOutput(CfnOutput output)func FromCfnOutput(Output CfnOutput) StackOutputReferencestatic#
Create a StackOutputReference that references the given CfnOutput.
isProducedBy(stack: StackDeployment): booleandef is_produced_by(self, stack: StackDeployment) -> boolpublic Boolean isProducedBy(StackDeployment stack)public bool IsProducedBy(StackDeployment stack)func IsProducedBy(Stack StackDeployment) *bool#
Whether or not this stack output is being produced by the given Stack deployment.