---
title: AWS CloudFormation actions
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/aws/cloudformation/aws-cloudformation
---

Use these actions to inspect stack status and resources, detect configuration drift, review change sets, and remediate stuck stacks directly from a workflow.

## Prerequisites

For prerequisites and credentials setup, see [Set up AWS credentials](https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/set-up-aws-credentials).

All CloudFormation actions accept the same auth inputs. Use `awsRoleArn` (recommended) or the access key pair (`awsAccessKeyId` and `awsSecretAccessKey`).

> #### ⚠️ IMPORTANT
>
> CloudFormation actions currently support only the `us-east-1` region.

> #### 💡 TIP
>
> The three stuck-stack remediation actions (`cancelUpdateStack`, `continueUpdateRollback`, `rollbackStack`) change stack state. We recommend using a separate, narrowly scoped IAM role for these actions rather than the read-only role you use for status and inspection actions. See the [IAM permissions](#iam-permissions) section below.

**Shared inputs**

The following inputs apply to all CloudFormation actions. Use `awsRoleArn` (recommended) or the access key pair.

| Input                | Type   | Description                                                       |
| -------------------- | ------ | ----------------------------------------------------------------- |
| `awsRoleArn`         | String | IAM role ARN to assume for this call.                             |
| `awsAccessKeyId`     | String | AWS access key ID. Pass as a secret.                              |
| `awsSecretAccessKey` | String | AWS secret access key. Pass as a secret.                          |
| `awsSessionToken`    | String | Temporary session token for STS authentication. Pass as a secret. |
| `selectors`          | List   | JQ selectors to extract specific fields from the action output.   |

## IAM permissions [#iam-permissions]

Each action requires a single CloudFormation permission matching its API name. The following table lists the required permission for each action.

| **Action**                          | **Required IAM permission**                        | **Additional permissions**                                                       |
| ----------------------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------- |
| `cancelUpdateStack`                 | `cloudformation:CancelUpdateStack`                 | None                                                                             |
| `continueUpdateRollback`            | `cloudformation:ContinueUpdateRollback`            | `iam:PassRole` on the role passed as `stackRoleArn`, only when that input is set |
| `rollbackStack`                     | `cloudformation:RollbackStack`                     | `iam:PassRole` on the role passed as `stackRoleArn`, only when that input is set |
| `describeStacks`                    | `cloudformation:DescribeStacks`                    | None                                                                             |
| `describeStackEvents`               | `cloudformation:DescribeStackEvents`               | None                                                                             |
| `describeStackResources`            | `cloudformation:DescribeStackResources`            | None                                                                             |
| `describeStackResource`             | `cloudformation:DescribeStackResource`             | None                                                                             |
| `listStacks`                        | `cloudformation:ListStacks`                        | None                                                                             |
| `listStackResources`                | `cloudformation:ListStackResources`                | None                                                                             |
| `getTemplate`                       | `cloudformation:GetTemplate`                       | None                                                                             |
| `detectStackDrift`                  | `cloudformation:DetectStackDrift`                  | None                                                                             |
| `describeStackDriftDetectionStatus` | `cloudformation:DescribeStackDriftDetectionStatus` | None                                                                             |
| `detectStackResourceDrift`          | `cloudformation:DetectStackResourceDrift`          | None                                                                             |
| `describeChangeSet`                 | `cloudformation:DescribeChangeSet`                 | None                                                                             |
| `listChangeSets`                    | `cloudformation:ListChangeSets`                    | None                                                                             |
| `getStackPolicy`                    | `cloudformation:GetStackPolicy`                    | None                                                                             |
| `listExports`                       | `cloudformation:ListExports`                       | None                                                                             |
| `listImports`                       | `cloudformation:ListImports`                       | None                                                                             |

We recommend two separate roles: a read-only role covering the 15 describe/list/get/detect actions, and a state-changing role scoped to `cancelUpdateStack`, `continueUpdateRollback`, and `rollbackStack`. Use the `awsRoleArn` input per step to switch between them in a single workflow.

## Cancel an in-progress stack update [#cancel-update-stack]

**Action identifier:** `aws.cloudformation.cancelUpdateStack`

Cancels an in-progress `UPDATE_IN_PROGRESS` update on a CloudFormation stack. Asynchronous — returns as soon as CloudFormation accepts the cancel request, not when the cancellation completes. Use [`aws.cloudformation.describeStacks`](#describe-stacks) to poll for `UPDATE_ROLLBACK_COMPLETE` or `UPDATE_ROLLBACK_FAILED`.

> #### ⚠️ IMPORTANT
>
> Call [`aws.cloudformation.describeStacks`](#describe-stacks) first to confirm the stack is actually in `UPDATE_IN_PROGRESS`. Canceling a stack that is not in that state returns an error.

### Inputs

| **Input**            | **Type** | **Description**                                                                                                                                                                | **Example**           |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------- |
| `region`             | String   | **Required.** AWS region of the target stack.                                                                                                                                  | `us-east-1`           |
| `stackName`          | String   | **Required.** Stack name or stack ID.                                                                                                                                          | `my-app-stack`        |
| `clientRequestToken` | String   | **Optional.** Idempotency token for this request. If you submit the same token twice, CloudFormation treats the second call as a duplicate and does not re-execute the action. | `my-cancel-token-123` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                    |
| -------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [cancel_update_stack Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/cancel_update_stack.html). Returns an empty object on success. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                              |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                      |

### Example

```yaml
name: cancel-stack-update
description: Confirm a stack is UPDATE_IN_PROGRESS and cancel the update
steps:
  - name: checkStatus
    type: action
    action: aws.cloudformation.describeStacks
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: stackStatus
          expression: ".response.Stacks[0].StackStatus"
  - name: isUpdateInProgress
    type: switch
    switch:
      - condition: ${{ .steps.checkStatus.outputs.stackStatus == "UPDATE_IN_PROGRESS" }}
        next: cancelUpdate
    next: end
  - name: cancelUpdate
    type: action
    action: aws.cloudformation.cancelUpdateStack
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
    next: end
```

## Continue an update rollback [#continue-update-rollback]

**Action identifier:** `aws.cloudformation.continueUpdateRollback`

Retries the rollback for a stack in `UPDATE_ROLLBACK_FAILED` state, either for all resources or for a subset you specify. If specific resources are blocking the rollback, use `resourcesToSkip` to skip them and let the remaining resources complete.

### Inputs

| **Input**            | **Type** | **Description**                                                                                                                                                                                                               | **Example**                                             |
| -------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `region`             | String   | **Required.** AWS region of the target stack.                                                                                                                                                                                 | `us-east-1`                                             |
| `stackName`          | String   | **Required.** Stack name or stack ID.                                                                                                                                                                                         | `my-app-stack`                                          |
| `stackRoleArn`       | String   | **Optional.** ARN of an IAM role for CloudFormation to use during the rollback. This is the role CloudFormation assumes, not the role used to call the API. Setting this input requires `iam:PassRole` on the specified role. | `arn:aws:iam::123456789012:role/my-cloudformation-role` |
| `resourcesToSkip`    | List     | **Optional.** Logical resource IDs to skip during rollback. Use when specific resources cannot be rolled back and are blocking the rest of the rollback.                                                                      | `["MyBucket", "MyLambdaFunction"]`                      |
| `clientRequestToken` | String   | **Optional.** Idempotency token for this request. If you submit the same token twice, CloudFormation treats the second call as a duplicate and does not re-execute the action.                                                | `my-rollback-token-123`                                 |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                              |
| -------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [continue_update_rollback Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/continue_update_rollback.html). Returns an empty object on success. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                        |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                |

### Example

```yaml
name: continue-stack-rollback
description: Continue rollback for a stack in UPDATE_ROLLBACK_FAILED
steps:
  - name: continueRollback
    type: action
    action: aws.cloudformation.continueUpdateRollback
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
    next: end
```

## Roll back a stack [#rollback-stack]

**Action identifier:** `aws.cloudformation.rollbackStack`

Rolls back an AWS CloudFormation stack to its last known stable state. Use this for stacks stuck in an indeterminate state that cannot be recovered through `continueUpdateRollback`.

### Inputs

| **Input**              | **Type** | **Description**                                                                                                                                                                                                               | **Example**                                             |
| ---------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `region`               | String   | **Required.** AWS region of the target stack.                                                                                                                                                                                 | `us-east-1`                                             |
| `stackName`            | String   | **Required.** Stack name or stack ID.                                                                                                                                                                                         | `my-app-stack`                                          |
| `stackRoleArn`         | String   | **Optional.** ARN of an IAM role for CloudFormation to use during the rollback. This is the role CloudFormation assumes, not the role used to call the API. Setting this input requires `iam:PassRole` on the specified role. | `arn:aws:iam::123456789012:role/my-cloudformation-role` |
| `clientRequestToken`   | String   | **Optional.** Idempotency token for this request. If you submit the same token twice, CloudFormation treats the second call as a duplicate and does not re-execute the action.                                                | `my-rollback-token-123`                                 |
| `retainExceptOnCreate` | Boolean  | **Optional.** If `true`, retains resources that were created during a failed create or update and cannot be rolled back. Default: `false`.                                                                                    | `false`                                                 |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                         |
| -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [rollback_stack Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/rollback_stack.html). Contains `OperationId` on success. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                   |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                           |

### Example

```yaml
name: rollback-stack
description: Roll back a CloudFormation stack to its last stable state
steps:
  - name: rollbackStack
    type: action
    action: aws.cloudformation.rollbackStack
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: operationId
          expression: ".response.OperationId"
    next: end
```

## Describe stacks [#describe-stacks]

**Action identifier:** `aws.cloudformation.describeStacks`

Returns summary and configuration information for one or more AWS CloudFormation stacks. Omit `stackName` to list all stacks in the region. The response is paginated — use `nextToken` from the previous response to retrieve the next page.

### Inputs

| **Input**   | **Type** | **Description**                                                                              | **Example**       |
| ----------- | -------- | -------------------------------------------------------------------------------------------- | ----------------- |
| `region`    | String   | **Required.** AWS region to query.                                                           | `us-east-1`       |
| `stackName` | String   | **Optional.** Stack name or stack ID. Omit to return all stacks in the region.               | `my-app-stack`    |
| `nextToken` | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request. | `some-next-token` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                   |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [describe_stacks Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/describe_stacks.html). Contains `Stacks[]` and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                             |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                     |

### Example

```yaml
name: describe-cloudformation-stack
description: Get the status of a CloudFormation stack
steps:
  - name: describeStack
    type: action
    action: aws.cloudformation.describeStacks
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: stackStatus
          expression: ".response.Stacks[0].StackStatus"
    next: end
```

## Describe stack events [#describe-stack-events]

**Action identifier:** `aws.cloudformation.describeStackEvents`

Returns all events for a specified AWS CloudFormation stack. Returns events in reverse chronological order (most recent first). The response is paginated — use `nextToken` from the previous response to retrieve earlier events.

### Inputs

| **Input**   | **Type** | **Description**                                                                              | **Example**       |
| ----------- | -------- | -------------------------------------------------------------------------------------------- | ----------------- |
| `region`    | String   | **Required.** AWS region of the target stack.                                                | `us-east-1`       |
| `stackName` | String   | **Required.** Stack name or stack ID.                                                        | `my-app-stack`    |
| `nextToken` | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request. | `some-next-token` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                    |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `response`     | Object   | See the [describe_stack_events Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/describe_stack_events.html). Contains `StackEvents[]` and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                              |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                      |

### Example

```yaml
name: get-stack-events
description: Retrieve recent events for a CloudFormation stack
steps:
  - name: describeStackEvents
    type: action
    action: aws.cloudformation.describeStackEvents
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: events
          expression: ".response.StackEvents"
    next: end
```

## Describe stack resources [#describe-stack-resources]

**Action identifier:** `aws.cloudformation.describeStackResources`

Returns a list of all resources in a specified AWS CloudFormation stack. You can filter by `logicalResourceId`. Provide either `stackName` or `physicalResourceId` — at least one is required.

### Inputs

| **Input**            | **Type** | **Description**                                                                                                                     | **Example**           |
| -------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `region`             | String   | **Required.** AWS region of the target stack.                                                                                       | `us-east-1`           |
| `stackName`          | String   | **Conditionally required.** Stack name or stack ID. Required if `physicalResourceId` is not provided.                               | `my-app-stack`        |
| `physicalResourceId` | String   | **Conditionally required.** Physical ID of the resource (for example, an EC2 instance ID). Required if `stackName` is not provided. | `i-0123456789abcdef0` |
| `logicalResourceId`  | String   | **Optional.** Logical resource ID (template name) to filter results to a single resource.                                           | `MyEC2Instance`       |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                       |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [describe_stack_resources Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/describe_stack_resources.html). Contains `StackResources[]`. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                 |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                         |

### Example

```yaml
name: get-stack-resources
description: List all resources in a CloudFormation stack
steps:
  - name: describeStackResources
    type: action
    action: aws.cloudformation.describeStackResources
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: resources
          expression: ".response.StackResources"
    next: end
```

## Describe a stack resource [#describe-stack-resource]

**Action identifier:** `aws.cloudformation.describeStackResource`

Returns detailed information for a single resource in an AWS CloudFormation stack, identified by its logical resource ID.

### Inputs

| **Input**           | **Type** | **Description**                                                                                                     | **Example**     |
| ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------- | --------------- |
| `region`            | String   | **Required.** AWS region of the target stack.                                                                       | `us-east-1`     |
| `stackName`         | String   | **Required.** Stack name or stack ID.                                                                               | `my-app-stack`  |
| `logicalResourceId` | String   | **Required.** Logical resource ID of the resource to describe (the resource's name in the CloudFormation template). | `MyEC2Instance` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                        |
| -------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [describe_stack_resource Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/describe_stack_resource.html). Contains `StackResourceDetail`. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                  |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                          |

### Example

```yaml
name: describe-stack-resource
description: Get the status of a specific resource in a CloudFormation stack
steps:
  - name: describeStackResource
    type: action
    action: aws.cloudformation.describeStackResource
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      logicalResourceId: MyEC2Instance
      selectors:
        - name: resourceStatus
          expression: ".response.StackResourceDetail.ResourceStatus"
    next: end
```

## List stacks [#list-stacks]

**Action identifier:** `aws.cloudformation.listStacks`

Returns summary information for AWS CloudFormation stacks in the account and region. Unlike `describeStacks`, this action also returns deleted stacks and supports filtering by stack status. The response is paginated — use `nextToken` from the previous response to retrieve the next page.

### Inputs

| **Input**           | **Type** | **Description**                                                                                                                                                                      | **Example**                                   |
| ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- |
| `region`            | String   | **Required.** AWS region to query.                                                                                                                                                   | `us-east-1`                                   |
| `stackStatusFilter` | List     | **Optional.** Filter results by one or more stack statuses (for example, `UPDATE_ROLLBACK_FAILED`, `CREATE_FAILED`). Omit to return stacks in all statuses except `DELETE_COMPLETE`. | `["UPDATE_ROLLBACK_FAILED", "CREATE_FAILED"]` |
| `nextToken`         | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request.                                                                                         | `some-next-token`                             |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                   |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [list_stacks Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/list_stacks.html). Contains `StackSummaries[]` and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                             |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                     |

### Example

```yaml
name: list-failed-stacks
description: List CloudFormation stacks in a failed rollback state
steps:
  - name: listFailedStacks
    type: action
    action: aws.cloudformation.listStacks
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackStatusFilter:
        - UPDATE_ROLLBACK_FAILED
        - CREATE_FAILED
      selectors:
        - name: stacks
          expression: ".response.StackSummaries"
    next: end
```

## List stack resources [#list-stack-resources]

**Action identifier:** `aws.cloudformation.listStackResources`

Returns summary information about all resources in an AWS CloudFormation stack. The response is paginated — use `nextToken` from the previous response to retrieve the next page.

### Inputs

| **Input**   | **Type** | **Description**                                                                              | **Example**       |
| ----------- | -------- | -------------------------------------------------------------------------------------------- | ----------------- |
| `region`    | String   | **Required.** AWS region of the target stack.                                                | `us-east-1`       |
| `stackName` | String   | **Required.** Stack name or stack ID.                                                        | `my-app-stack`    |
| `nextToken` | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request. | `some-next-token` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                             |
| -------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [list_stack_resources Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/list_stack_resources.html). Contains `StackResourceSummaries[]` and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                                       |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                               |

### Example

```yaml
name: list-stack-resources
description: List all resources in a CloudFormation stack
steps:
  - name: listStackResources
    type: action
    action: aws.cloudformation.listStackResources
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: resources
          expression: ".response.StackResourceSummaries"
    next: end
```

## Get a stack template [#get-template]

**Action identifier:** `aws.cloudformation.getTemplate`

Returns the AWS CloudFormation template body for a stack or change set. Use `templateStage` to retrieve the original user-submitted template or the processed template after CloudFormation transforms have been applied.

### Inputs

| **Input**       | **Type** | **Description**                                                                                                                                          | **Example**     |
| --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
| `region`        | String   | **Required.** AWS region of the target stack.                                                                                                            | `us-east-1`     |
| `stackName`     | String   | **Optional.** Stack name or stack ID. Required if `changeSetName` is not provided.                                                                       | `my-app-stack`  |
| `changeSetName` | String   | **Optional.** Change set name or ARN. Use to retrieve the template for a specific change set rather than the deployed stack.                             | `my-change-set` |
| `templateStage` | String   | **Optional.** Which version of the template to return. Allowed values: `Original` (user-submitted), `Processed` (after transforms). Default: `Original`. | `Original`      |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                 |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [get_template Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/get_template.html). Contains `TemplateBody` and `StagesAvailable`. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                           |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                   |

### Example

```yaml
name: get-stack-template
description: Retrieve the template body for a CloudFormation stack
steps:
  - name: getTemplate
    type: action
    action: aws.cloudformation.getTemplate
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      templateStage: Original
      selectors:
        - name: templateBody
          expression: ".response.TemplateBody"
    next: end
```

## Detect stack drift [#detect-stack-drift]

**Action identifier:** `aws.cloudformation.detectStackDrift`

Starts a drift detection operation on a CloudFormation stack and returns a `StackDriftDetectionId`. Asynchronous — returns immediately after CloudFormation accepts the request. Use [`aws.cloudformation.describeStackDriftDetectionStatus`](#describe-stack-drift-detection-status) with the `StackDriftDetectionId` to poll until `DetectionStatus` reaches `DETECTION_COMPLETE` or `DETECTION_FAILED`.

### Inputs

| **Input**            | **Type** | **Description**                                                                                                                      | **Example**                        |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- |
| `region`             | String   | **Required.** AWS region of the target stack.                                                                                        | `us-east-1`                        |
| `stackName`          | String   | **Required.** Stack name or stack ID.                                                                                                | `my-app-stack`                     |
| `logicalResourceIds` | List     | **Optional.** Filter drift detection to specific logical resource IDs. Omit to detect drift on all supported resources in the stack. | `["MyBucket", "MyLambdaFunction"]` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `response`     | Object   | See the [detect_stack_drift Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/detect_stack_drift.html). Contains `StackDriftDetectionId`. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                          |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                  |

### Example

```yaml
name: detect-stack-drift
description: Start drift detection on a stack and poll until it completes
steps:
  - name: startDriftDetection
    type: action
    action: aws.cloudformation.detectStackDrift
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: driftDetectionId
          expression: ".response.StackDriftDetectionId"
  - name: waitForDetection
    type: wait
    seconds: 15
  - name: checkDriftStatus
    type: action
    action: aws.cloudformation.describeStackDriftDetectionStatus
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackDriftDetectionId: ${{ .steps.startDriftDetection.outputs.driftDetectionId }}
      selectors:
        - name: detectionStatus
          expression: ".response.DetectionStatus"
        - name: stackDriftStatus
          expression: ".response.StackDriftStatus"
  - name: isDriftDetectionDone
    type: switch
    switch:
      - condition: ${{ .steps.checkDriftStatus.outputs.detectionStatus == "DETECTION_COMPLETE" or .steps.checkDriftStatus.outputs.detectionStatus == "DETECTION_FAILED" }}
        next: end
    next: waitForDetection
```

## Describe stack drift detection status [#describe-stack-drift-detection-status]

**Action identifier:** `aws.cloudformation.describeStackDriftDetectionStatus`

Returns the status of an AWS CloudFormation drift detection operation started by [`aws.cloudformation.detectStackDrift`](#detect-stack-drift). Poll this action with the `StackDriftDetectionId` until `DetectionStatus` is `DETECTION_COMPLETE` or `DETECTION_FAILED`.

### Inputs

| **Input**               | **Type** | **Description**                                                            | **Example**                       |
| ----------------------- | -------- | -------------------------------------------------------------------------- | --------------------------------- |
| `region`                | String   | **Required.** AWS region of the target stack.                              | `us-east-1`                       |
| `stackDriftDetectionId` | String   | **Required.** Drift detection operation ID returned by `detectStackDrift`. | `3f451a7b-0f41-4a8b-a3f5-example` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                                                                                                      |
| -------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [describe_stack_drift_detection_status Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/describe_stack_drift_detection_status.html). Contains `StackId`, `StackName`, `StackDriftDetectionId`, `DetectionStatus`, `StackDriftStatus`, and `Timestamp`. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                                                                                                                |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                                                                                                        |

### Example

```yaml
name: check-drift-detection-status
description: Check the status of a CloudFormation drift detection operation
steps:
  - name: checkDriftStatus
    type: action
    action: aws.cloudformation.describeStackDriftDetectionStatus
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackDriftDetectionId: 3f451a7b-0f41-4a8b-a3f5-example
      selectors:
        - name: detectionStatus
          expression: ".response.DetectionStatus"
        - name: stackDriftStatus
          expression: ".response.StackDriftStatus"
    next: end
```

## Detect stack resource drift [#detect-stack-resource-drift]

**Action identifier:** `aws.cloudformation.detectStackResourceDrift`

Returns drift information for a single resource in a CloudFormation stack. Unlike `detectStackDrift`, runs synchronously and returns the result directly. Use it to check drift on a specific resource without triggering full-stack detection.

### Inputs

| **Input**           | **Type** | **Description**                                                       | **Example**    |
| ------------------- | -------- | --------------------------------------------------------------------- | -------------- |
| `region`            | String   | **Required.** AWS region of the target stack.                         | `us-east-1`    |
| `stackName`         | String   | **Required.** Stack name or stack ID.                                 | `my-app-stack` |
| `logicalResourceId` | String   | **Required.** Logical resource ID of the resource to check for drift. | `MyBucket`     |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                                                                                                    |
| -------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [detect_stack_resource_drift Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/detect_stack_resource_drift.html). Contains `StackResourceDrift` with `StackResourceDriftStatus`, `ExpectedProperties`, `ActualProperties`, and `PropertyDifferences`. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                                                                                                              |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                                                                                                      |

### Example

```yaml
name: detect-resource-drift
description: Check a single CloudFormation resource for configuration drift
steps:
  - name: detectResourceDrift
    type: action
    action: aws.cloudformation.detectStackResourceDrift
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      logicalResourceId: MyBucket
      selectors:
        - name: driftStatus
          expression: ".response.StackResourceDrift.StackResourceDriftStatus"
        - name: propertyDifferences
          expression: ".response.StackResourceDrift.PropertyDifferences"
    next: end
```

## Describe a change set [#describe-change-set]

**Action identifier:** `aws.cloudformation.describeChangeSet`

Returns the properties of an AWS CloudFormation change set. If the change set has more than one page of changes, use `nextToken` to paginate through the full list.

### Inputs

| **Input**               | **Type** | **Description**                                                                                                    | **Example**       |
| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------ | ----------------- |
| `region`                | String   | **Required.** AWS region of the target stack.                                                                      | `us-east-1`       |
| `changeSetName`         | String   | **Required.** Change set name or ARN. If you provide a name rather than an ARN, you must also provide `stackName`. | `my-change-set`   |
| `stackName`             | String   | **Optional.** Stack name or stack ID. Required when `changeSetName` is a name rather than an ARN.                  | `my-app-stack`    |
| `nextToken`             | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request.                       | `some-next-token` |
| `includePropertyValues` | Boolean  | **Optional.** If `true`, includes before and after property values for each changed resource. Default: `false`.    | `false`           |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                                                                  |
| -------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [describe_change_set Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/describe_change_set.html). Contains `ChangeSetId`, `StackId`, `ChangeSetName`, `Status`, `Changes[]`, and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                                                                            |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                                                                    |

### Example

```yaml
name: describe-change-set
description: Review the changes in a CloudFormation change set
steps:
  - name: describeChangeSet
    type: action
    action: aws.cloudformation.describeChangeSet
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      changeSetName: my-change-set
      stackName: my-app-stack
      selectors:
        - name: changes
          expression: ".response.Changes"
        - name: status
          expression: ".response.Status"
    next: end
```

## List change sets [#list-change-sets]

**Action identifier:** `aws.cloudformation.listChangeSets`

Returns a list of all change sets associated with an AWS CloudFormation stack. The response is paginated — use `nextToken` from the previous response to retrieve the next page.

### Inputs

| **Input**   | **Type** | **Description**                                                                              | **Example**       |
| ----------- | -------- | -------------------------------------------------------------------------------------------- | ----------------- |
| `region`    | String   | **Required.** AWS region of the target stack.                                                | `us-east-1`       |
| `stackName` | String   | **Required.** Stack name or stack ID.                                                        | `my-app-stack`    |
| `nextToken` | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request. | `some-next-token` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                        |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `response`     | Object   | See the [list_change_sets Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/list_change_sets.html). Contains `Summaries[]` and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                  |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                          |

### Example

```yaml
name: list-stack-change-sets
description: List all change sets for a CloudFormation stack
steps:
  - name: listChangeSets
    type: action
    action: aws.cloudformation.listChangeSets
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: changeSets
          expression: ".response.Summaries"
    next: end
```

## Get a stack policy [#get-stack-policy]

**Action identifier:** `aws.cloudformation.getStackPolicy`

Returns the stack policy for a specified AWS CloudFormation stack. If the stack has no policy, `response.StackPolicyBody` is empty.

### Inputs

| **Input**   | **Type** | **Description**                               | **Example**    |
| ----------- | -------- | --------------------------------------------- | -------------- |
| `region`    | String   | **Required.** AWS region of the target stack. | `us-east-1`    |
| `stackName` | String   | **Required.** Stack name or stack ID.         | `my-app-stack` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                     |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [get_stack_policy Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/get_stack_policy.html). Contains `StackPolicyBody` as a JSON string, or empty if no policy is set. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                               |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                       |

### Example

```yaml
name: get-stack-policy
description: Retrieve the stack policy for a CloudFormation stack
steps:
  - name: getStackPolicy
    type: action
    action: aws.cloudformation.getStackPolicy
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      stackName: my-app-stack
      selectors:
        - name: stackPolicy
          expression: ".response.StackPolicyBody"
    next: end
```

## List exports [#list-exports]

**Action identifier:** `aws.cloudformation.listExports`

Returns a list of all exported output values across all AWS CloudFormation stacks in the account and region. The response is paginated — use `nextToken` from the previous response to retrieve the next page.

### Inputs

| **Input**   | **Type** | **Description**                                                                              | **Example**       |
| ----------- | -------- | -------------------------------------------------------------------------------------------- | ----------------- |
| `region`    | String   | **Required.** AWS region to query.                                                           | `us-east-1`       |
| `nextToken` | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request. | `some-next-token` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                                              |
| -------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [list_exports Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/list_exports.html). Contains `Exports[]` (each with `Name`, `Value`, `ExportingStackId`) and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                                                        |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                                                |

### Example

```yaml
name: list-stack-exports
description: List all CloudFormation cross-stack exports in a region
steps:
  - name: listExports
    type: action
    action: aws.cloudformation.listExports
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      selectors:
        - name: exports
          expression: ".response.Exports"
    next: end
```

## List imports [#list-imports]

**Action identifier:** `aws.cloudformation.listImports`

Returns a list of AWS CloudFormation stacks that import a specified export. Use this to identify which stacks depend on a given exported value before making changes. The response is paginated — use `nextToken` from the previous response to retrieve the next page.

### Inputs

| **Input**    | **Type** | **Description**                                                                              | **Example**       |
| ------------ | -------- | -------------------------------------------------------------------------------------------- | ----------------- |
| `region`     | String   | **Required.** AWS region to query.                                                           | `us-east-1`       |
| `exportName` | String   | **Required.** Name of the exported output value to look up.                                  | `SharedVpcId`     |
| `nextToken`  | String   | **Optional.** Pagination token from a previous response. Leave empty on the initial request. | `some-next-token` |

For auth and selector inputs, see [Prerequisites](#prerequisites).

### Outputs

| **Output**     | **Type** | **Example**                                                                                                                                                                                                                                           |
| -------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `response`     | Object   | See the [list_imports Boto3 reference](https://docs.aws.amazon.com/boto3/latest/reference/services/cloudformation/client/list_imports.html). Contains `Imports[]` (list of stack names that import the export) and `NextToken` when more pages exist. |
| `success`      | Boolean  | `true` or `false`                                                                                                                                                                                                                                     |
| `errorMessage` | String   | Error message on failure.                                                                                                                                                                                                                             |

### Example

```yaml
name: list-export-consumers
description: Find all stacks that import a CloudFormation exported value
steps:
  - name: listImports
    type: action
    action: aws.cloudformation.listImports
    version: '1'
    inputs:
      awsRoleArn: ${{ :secrets:awsRoleArn }}
      region: us-east-1
      exportName: SharedVpcId
      selectors:
        - name: imports
          expression: ".response.Imports"
    next: end
```
