Class CloudFormationCreateUpdateStackAction

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.CloudFormationCreateUpdateStackAction
All Implemented Interfaces:
IAction, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-15T10:24:56.661Z") @Stability(Stable) public class CloudFormationCreateUpdateStackAction extends Action
CodePipeline action to deploy a stack.

Creates the stack if the specified stack doesn't exist. If the stack exists, AWS CloudFormation updates the stack. Use this action to update existing stacks.

AWS CodePipeline won't replace the stack, and will fail deployment if the stack is in a failed state. Use ReplaceOnFailure for an action that will delete and recreate the stack to try and recover from failed states.

Use this action to automatically replace failed stacks without recovering or troubleshooting them. You would typically choose this mode for testing.

Example:

 import software.amazon.awscdk.PhysicalName;
 // in stack for account 123456789012...
 Stack otherAccountStack;
 Role actionRole = Role.Builder.create(otherAccountStack, "ActionRole")
         .assumedBy(new AccountPrincipal("123456789012"))
         // the role has to have a physical name set
         .roleName(PhysicalName.GENERATE_IF_NEEDED)
         .build();
 // in the pipeline stack...
 Artifact sourceOutput = new Artifact();
 CloudFormationCreateUpdateStackAction.Builder.create()
         .actionName("CloudFormationCreateUpdate")
         .stackName("MyStackName")
         .adminPermissions(true)
         .templatePath(sourceOutput.atPath("template.yaml"))
         .role(actionRole)
         .build();
 
  • Constructor Details

    • CloudFormationCreateUpdateStackAction

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

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

      @Stability(Stable) public CloudFormationCreateUpdateStackAction(@NotNull CloudFormationCreateUpdateStackActionProps 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 software.constructs.Construct scope, @NotNull IStage stage, @NotNull ActionBindOptions options)
      This is a renamed version of the 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()