How to use the @aws-cdk/aws-codepipeline-actions.CloudFormationCreateReplaceChangeSetAction function in @aws-cdk/aws-codepipeline-actions

To help you get started, we’ve selected a few @aws-cdk/aws-codepipeline-actions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / @aws-cdk / app-delivery / lib / pipeline-deploy-stack-action.ts View on Github external
this.stack = props.stack;
    const assets = this.stack.node.metadata.filter(md => md.type === cxapi.ASSET_METADATA);
    if (assets.length > 0) {
      // FIXME: Implement the necessary actions to publish assets
      throw new Error(`Cannot deploy the stack ${this.stack.stackName} because it references ${assets.length} asset(s)`);
    }

    const createChangeSetRunOrder = props.createChangeSetRunOrder || 1;
    const executeChangeSetRunOrder = props.executeChangeSetRunOrder || (createChangeSetRunOrder + 1);
    if (createChangeSetRunOrder >= executeChangeSetRunOrder) {
      throw new Error(`createChangeSetRunOrder (${createChangeSetRunOrder}) must be < executeChangeSetRunOrder (${executeChangeSetRunOrder})`);
    }

    const changeSetName = props.changeSetName || 'CDK-CodePipeline-ChangeSet';
    const capabilities = cfnCapabilities(props.adminPermissions, props.capabilities);
    this.prepareChangeSetAction = new cpactions.CloudFormationCreateReplaceChangeSetAction({
      actionName: 'ChangeSet',
      changeSetName,
      runOrder: createChangeSetRunOrder,
      stackName: props.stack.stackName,
      templatePath: props.input.atPath(props.stack.templateFile),
      adminPermissions: props.adminPermissions,
      deploymentRole: props.role,
      capabilities,
    });
    this.executeChangeSetAction = new cpactions.CloudFormationExecuteChangeSetAction({
      actionName: 'Execute',
      changeSetName,
      runOrder: executeChangeSetRunOrder,
      stackName: this.stack.stackName,
    });
  }