# TopicPolicyProps

Properties to associate SNS topics with a policy.

Extends: TopicPolicyProps
Used as props by: TopicPolicy

- Source: [`aws-sns/lib/policy.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-sns/lib/policy.ts#L12)
- Type last changed: v2.129.0 · 21 Feb 2024

## Example

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

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

## Properties

- `enforceSSL`: boolean = false — Adds a statement to enforce encryption of data in transit when publishing to the topic.

  For more information, see https://docs.aws.amazon.com/sns/latest/dg/sns-security-best-practices.html#enforce-encryption-data-in-transit.

- `policyDocument`: [PolicyDocument](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyDocument.html) — IAM policy document to apply to topic(s).

  **Default:** empty policy document

- `topics`: [ITopic](/cdk/api/v2/docs/aws-cdk-lib.aws_sns.ITopic.html)[] (required) — The set of topics this policy applies to.
