-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SNS Topic Policy can't be created and synth'd #7934
Comments
Hi @mbonig, sorry for the late reply. It does seem like this is a bug, I'm getting the same error. So I'll file this as a bug and we'll add it to our workload. In the meantime, you might want to try using |
TopicPolicy class had a bug. It did specify a mandatory prop for IAM policy document to use in AWS::SNS::TopicPolicy fixes aws#7934
Do we have any updates for this issue? I'm not blocked but would be nice to have this. |
So after spending some time researching this and talking to @rix0rrr, I think that the correct usage here is to use export class Issue10559Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const topic = new sns.Topic(this, 'Topic');
const topicPolicy = new sns.TopicPolicy(this, 'Policy', {
topics: [topic],
});
topicPolicy.document.addStatements(new iam.PolicyStatement({
actions: ["sns:Subscribe"],
principals: [new iam.AccountPrincipal('430030518091')],
resources: [topic.topicArn]
})
);
}
} General I'd recommend using |
Additionally added an issue to track the addition of local input validation for the policy statements passed to PolicyDocument. |
Adds optional `policyDocument` prop to `TopicPolicyProps` to allow passing existing policy documents. fixes #7934 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Adds optional `policyDocument` prop to `TopicPolicyProps` to allow passing existing policy documents. fixes aws#7934 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Adds optional `policyDocument` prop to `TopicPolicyProps` to allow passing existing policy documents. fixes aws#7934 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Adds optional `policyDocument` prop to `TopicPolicyProps` to allow passing existing policy documents. fixes aws#7934 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
❓ General Issue
When creating an SNS TopicPolicy the Props only have
topics
as a field. However, there also needs to be a PolicyDocument field and without it an error occurs during synth. There doesn't appear to be any way to set it, either through the Props in the constructor or after the fact.The Question
With this minimum example:
An error occurs during synth:
Environment
Other information
The text was updated successfully, but these errors were encountered: