Skip to content

Commit 1e1131c

Browse files
authored
fix(sns): sns subscription filter policy condition limit should be 150 (#24269)
The [Filter policy constraints docs](https://docs.aws.amazon.com/sns/latest/dg/subscription-filter-policy-constraints.html) says: > For the complexity of the filter policy, the total combination of values must not exceed 150. Calculate the total combination by multiplying the number of values in each array. This PR sets the complexity limit to the correct value. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent e47646c commit 1e1131c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/@aws-cdk/aws-sns/lib/subscription.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ export class Subscription extends Resource {
112112

113113
let total = 1;
114114
Object.values(this.filterPolicy).forEach(filter => { total *= filter.length; });
115-
if (total > 100) {
116-
throw new Error(`The total combination of values (${total}) must not exceed 100.`);
115+
if (total > 150) {
116+
throw new Error(`The total combination of values (${total}) must not exceed 150.`);
117117
}
118118
}
119119

packages/@aws-cdk/aws-sns/test/subscription.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe('Subscription', () => {
256256

257257
});
258258

259-
test('throws with more than 100 conditions in a filter policy', () => {
259+
test('throws with more than 150 conditions in a filter policy', () => {
260260
// GIVEN
261261
const stack = new cdk.Stack();
262262
const topic = new sns.Topic(stack, 'Topic');
@@ -269,9 +269,9 @@ describe('Subscription', () => {
269269
filterPolicy: {
270270
a: { conditions: [...Array.from(Array(2).keys())] },
271271
b: { conditions: [...Array.from(Array(10).keys())] },
272-
c: { conditions: [...Array.from(Array(6).keys())] },
272+
c: { conditions: [...Array.from(Array(8).keys())] },
273273
},
274-
})).toThrow(/\(120\) must not exceed 100/);
274+
})).toThrow(/\(160\) must not exceed 150/);
275275

276276
});
277277

0 commit comments

Comments
 (0)