# PolicyDocumentProps

Properties for a new PolicyDocument.

Extends: PolicyDocumentProps
Used as props by: PolicyDocument

- Source: [`aws-iam/lib/policy-document.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-iam/lib/policy-document.ts#L13)
- Type last changed: v2.18.0 · 29 Mar 2022

## Example

```ts
const topic = new sns.Topic(this, 'Topic');
const policyDocument = new iam.PolicyDocument({
  assignSids: true,
  statements: [
    new iam.PolicyStatement({
      actions: ["sns:Publish"],
      principals: [new iam.ServicePrincipal('s3.amazonaws.com')],
      resources: [topic.topicArn],
    }),
  ],
});

const topicPolicy = new sns.TopicPolicy(this, 'Policy', {
  topics: [topic],
  policyDocument,
  enforceSSL: true,
});
```

## Properties

- `assignSids`: boolean = false — Automatically assign Statement Ids to all statements.

- `minimize`: boolean — Try to minimize the policy by merging statements.

  **Default:** false, unless the feature flag `@aws-cdk/aws-iam:minimizePolicies` is set

  To avoid overrunning the maximum policy size, combine statements if they produce
  the same result. Merging happens according to the following rules:

  - The Effect of both statements is the same
  - Neither of the statements have a 'Sid'
  - Combine Principals if the rest of the statement is exactly the same.
  - Combine Resources if the rest of the statement is exactly the same.
  - Combine Actions if the rest of the statement is exactly the same.
  - We will never combine NotPrincipals, NotResources or NotActions, because doing
    so would change the meaning of the policy document.

- `statements`: [PolicyStatement](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html)[] — Initial statements to add to the policy document.

  **Default:** No statements
