Class CloudFormationCreateReplaceChangeSetAction

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.codepipeline.Action
software.amazon.awscdk.services.codepipeline.actions.Action
software.amazon.awscdk.services.codepipeline.actions.CloudFormationCreateReplaceChangeSetAction
All Implemented Interfaces:
IAction, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:48.351Z") @Stability(Stable) public class CloudFormationCreateReplaceChangeSetAction 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
 Repository repo = Repository.Builder.create(stack, "TemplateRepo")
         .repositoryName("template-repo")
         .build();
 Artifact sourceOutput = new Artifact("SourceArtifact");
 CodeCommitSourceAction source = CodeCommitSourceAction.Builder.create()
         .actionName("Source")
         .repository(repo)
         .output(sourceOutput)
         .trigger(CodeCommitTrigger.POLL)
         .build();
 Map<String, Object> sourceStage = Map.of(
         "stageName", "Source",
         "actions", List.of(source));
 // Deployment stage: create and deploy changeset with manual approval
 String stackName = "OurStack";
 String changeSetName = "StagedChangeSet";
 Map<String, Object> prodStage = Map.of(
         "stageName", "Deploy",
         "actions", List.of(
             CloudFormationCreateReplaceChangeSetAction.Builder.create()
                     .actionName("PrepareChanges")
                     .stackName(stackName)
                     .changeSetName(changeSetName)
                     .adminPermissions(true)
                     .templatePath(sourceOutput.atPath("template.yaml"))
                     .runOrder(1)
                     .build(),
             ManualApprovalAction.Builder.create()
                     .actionName("ApproveChanges")
                     .runOrder(2)
                     .build(),
             CloudFormationExecuteChangeSetAction.Builder.create()
                     .actionName("ExecuteChanges")
                     .stackName(stackName)
                     .changeSetName(changeSetName)
                     .runOrder(3)
                     .build()));
 Pipeline.Builder.create(stack, "Pipeline")
         .stages(List.of(sourceStage, prodStage))
         .build();
 
  • Constructor Details

    • CloudFormationCreateReplaceChangeSetAction

      protected CloudFormationCreateReplaceChangeSetAction(software.amazon.jsii.JsiiObjectRef objRef)
    • CloudFormationCreateReplaceChangeSetAction

      protected CloudFormationCreateReplaceChangeSetAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CloudFormationCreateReplaceChangeSetAction

      @Stability(Stable) public CloudFormationCreateReplaceChangeSetAction(@NotNull CloudFormationCreateReplaceChangeSetActionProps props)
      Parameters:
      props - This parameter is required.
  • Method Details

    • addToDeploymentRolePolicy

      @Stability(Stable) @NotNull public Boolean addToDeploymentRolePolicy(@NotNull PolicyStatement statement)
      Add statement to the service role assumed by CloudFormation while executing this action.

      Parameters:
      statement - This parameter is required.
    • bound

      @Stability(Stable) @NotNull protected ActionConfig bound(@NotNull Construct scope, @NotNull IStage stage, @NotNull ActionBindOptions options)
      This is a renamed version of the
      invalid @link
      IAction.bind
      method.

      Specified by:
      bound in class Action
      Parameters:
      scope - This parameter is required.
      stage - This parameter is required.
      options - This parameter is required.
    • getDeploymentRole

      @Stability(Stable) @NotNull public IRole getDeploymentRole()