# CloudFormationDeployStackSetAction

CodePipeline action to deploy a stackset.

CodePipeline offers the ability to perform AWS CloudFormation StackSets
operations as part of your CI/CD process. You use a stack set to create
stacks in AWS accounts across AWS Regions by using a single AWS
CloudFormation template. All the resources included in each stack are defined
by the stack set’s AWS CloudFormation template. When you create the stack
set, you specify the template to use, as well as any parameters and
capabilities that the template requires.

For more information about concepts for AWS CloudFormation StackSets, see
[StackSets
concepts](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html)
in the AWS CloudFormation User Guide.

If you use this action to make an update that includes adding stack
instances, the new instances are deployed first and the update is completed
last. The new instances first receive the old version, and then the update is
applied to all instances.

As a best practice, you should construct your pipeline so that the stack set
is created and initially deploys to a subset or a single instance. After you
test your deployment and view the generated stack set, then add the
CloudFormationStackInstances action so that the remaining instances are
created and updated.

Extends: Action › Action › CloudFormationDeployStackSetAction
Implements: IAction

- Source: [`aws-codepipeline-actions/lib/cloudformation/stackset-action.ts`](https://github.com/aws/aws-cdk/blob/v2.273.0/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackset-action.ts#L113)
- Type last changed: v2.13.0 · 19 Feb 2022

## Example

```ts
declare const pipeline: codepipeline.Pipeline;
declare const sourceOutput: codepipeline.Artifact;

pipeline.addStage({
  stageName: 'DeployStackSets',
  actions: [
    // First, update the StackSet itself with the newest template
    new codepipeline_actions.CloudFormationDeployStackSetAction({
      actionName: 'UpdateStackSet',
      runOrder: 1,
      stackSetName: 'MyStackSet',
      template: codepipeline_actions.StackSetTemplate.fromArtifactPath(sourceOutput.atPath('template.yaml')),

      // Change this to 'StackSetDeploymentModel.organizations()' if you want to deploy to OUs
      deploymentModel: codepipeline_actions.StackSetDeploymentModel.selfManaged(),
      // This deploys to a set of accounts
      stackInstances: codepipeline_actions.StackInstances.inAccounts(['111111111111'], ['us-east-1', 'eu-west-1']),
    }),

    // Afterwards, update/create additional instances in other accounts
    new codepipeline_actions.CloudFormationDeployStackInstancesAction({
      actionName: 'AddMoreInstances',
      runOrder: 2,
      stackSetName: 'MyStackSet',
      stackInstances: codepipeline_actions.StackInstances.inAccounts(
        ['222222222222', '333333333333'],
        ['us-east-1', 'eu-west-1']
      ),
    }),
  ],
});
```

## Initializer

```ts
new CloudFormationDeployStackSetAction(props: CloudFormationDeployStackSetActionProps)
```

## Properties

- `actionProperties`: [ActionProperties](/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ActionProperties.html) (required) — The simple properties of the Action, like its Owner, name, etc.

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

## Methods

- `bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig` — The callback invoked when this Action is added to a Pipeline.

- `onStateChange(name: string, target?: IRuleTarget, options?: RuleProps): Rule` — Creates an Event that will be triggered whenever the state of this Action changes.
