# StackFiltersProperty

The `StackFilters` property type specifies stack level filters for a Hook.

The `StackNames` or `StackRoles` properties are optional. However, you must specify at least one of these properties.

For more information, see [CloudFormation Hooks stack level filters](https://docs.aws.amazon.com/cloudformation-cli/latest/hooks-userguide/hooks-stack-level-filtering.html) .

- Source: Generated code
- Type last changed: v2.168.0 · 20 Nov 2024

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudformation as cloudformation } from 'aws-cdk-lib';
const stackFiltersProperty: cloudformation.CfnGuardHook.StackFiltersProperty = {
  filteringCriteria: 'filteringCriteria',

  // the properties below are optional
  stackNames: {
    exclude: ['exclude'],
    include: ['include'],
  },
  stackRoles: {
    exclude: ['exclude'],
    include: ['include'],
  },
};
```

## Properties

- `filteringCriteria`: string (required) = "ALL" — The filtering criteria.

  - All stack names and stack roles ( `All` ): The Hook will only be invoked when all specified filters match.
  - Any stack names and stack roles ( `Any` ): The Hook will be invoked if at least one of the specified filters match.

- `stackNames`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGuardHook.StackNamesProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudformation.CfnGuardHook.StackNamesProperty.html) — Includes or excludes specific stacks from Hook invocations.

- `stackRoles`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGuardHook.StackRolesProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudformation.CfnGuardHook.StackRolesProperty.html) — Includes or excludes specific stacks from Hook invocations based on their associated IAM roles.
