aws-cdk-lib.aws_codepipeline_actions.CloudFormationCreateReplaceChangeSetAction

class CloudFormationCreateReplaceChangeSetAction

LanguageType name
.NETAmazon.CDK.AWS.CodePipeline.Actions.CloudFormationCreateReplaceChangeSetAction
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscodepipelineactions#CloudFormationCreateReplaceChangeSetAction
Javasoftware.amazon.awscdk.services.codepipeline.actions.CloudFormationCreateReplaceChangeSetAction
Pythonaws_cdk.aws_codepipeline_actions.CloudFormationCreateReplaceChangeSetAction
TypeScript (source)aws-cdk-lib » aws_codepipeline_actions » CloudFormationCreateReplaceChangeSetAction

Implements IAction

Extends Action

CodePipeline action to prepare a change set.

Creates the change set if it doesn't exist based on the stack name and template that you submit. If the change set exists, AWS CloudFormation deletes it, and then creates a new one.

Example

// Source stage: read from repository
const repo = new codecommit.Repository(stack, 'TemplateRepo', {
  repositoryName: 'template-repo',
});
const sourceOutput = new codepipeline.Artifact('SourceArtifact');
const source = new cpactions.CodeCommitSourceAction({
  actionName: 'Source',
  repository: repo,
  output: sourceOutput,
  trigger: cpactions.CodeCommitTrigger.POLL,
});
const sourceStage = {
  stageName: 'Source',
  actions: [source],
};

// Deployment stage: create and deploy changeset with manual approval
const stackName = 'OurStack';
const changeSetName = 'StagedChangeSet';

const prodStage = {
  stageName: 'Deploy',
  actions: [
    new cpactions.CloudFormationCreateReplaceChangeSetAction({
      actionName: 'PrepareChanges',
      stackName,
      changeSetName,
      adminPermissions: true,
      templatePath: sourceOutput.atPath('template.yaml'),
      runOrder: 1,
    }),
    new cpactions.ManualApprovalAction({
      actionName: 'ApproveChanges',
      runOrder: 2,
    }),
    new cpactions.CloudFormationExecuteChangeSetAction({
      actionName: 'ExecuteChanges',
      stackName,
      changeSetName,
      runOrder: 3,
    }),
  ],
};

new codepipeline.Pipeline(stack, 'Pipeline', {
  stages: [
    sourceStage,
    prodStage,
  ],
});

Initializer

new CloudFormationCreateReplaceChangeSetAction(props: CloudFormationCreateReplaceChangeSetActionProps)

Parameters

  • props CloudFormationCreateReplaceChangeSetActionProps

Properties

NameTypeDescription
actionPropertiesActionPropertiesThe simple properties of the Action, like its Owner, name, etc.
deploymentRoleIRole

actionProperties

Type: ActionProperties

The simple properties of the Action, like its Owner, name, etc.

Note that this accessor will be called before the bind callback.


deploymentRole

Type: IRole

Methods

NameDescription
addToDeploymentRolePolicy(statement)Add statement to the service role assumed by CloudFormation while executing this action.
bind(scope, stage, options)The callback invoked when this Action is added to a Pipeline.
onStateChange(name, target?, options?)Creates an Event that will be triggered whenever the state of this Action changes.
protected bound(scope, stage, options)This is a renamed version of the IAction.bind method.

addToDeploymentRolePolicy(statement)

public addToDeploymentRolePolicy(statement: PolicyStatement): boolean

Parameters

  • statement PolicyStatement

Returns

  • boolean

Add statement to the service role assumed by CloudFormation while executing this action.


bind(scope, stage, options)

public bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig

Parameters

  • scope Construct
  • stage IStage
  • options ActionBindOptions

Returns

  • ActionConfig

The callback invoked when this Action is added to a Pipeline.


onStateChange(name, target?, options?)

public onStateChange(name: string, target?: IRuleTarget, options?: RuleProps): Rule

Parameters

  • name string
  • target IRuleTarget
  • options RuleProps

Returns

  • Rule

Creates an Event that will be triggered whenever the state of this Action changes.


protected bound(scope, stage, options)

protected bound(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig

Parameters

  • scope Construct
  • stage IStage
  • options ActionBindOptions

Returns

  • ActionConfig

This is a renamed version of the IAction.bind method.