Skip to content
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

feat(sns): enable passing PolicyDocument to TopicPolicy #10559

Merged
merged 13 commits into from
Mar 17, 2021

Conversation

ap00rv
Copy link
Contributor

@ap00rv ap00rv commented Sep 27, 2020

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

merging new changes from master of aws/aws-cdk
TopicPolicy class had a bug. It did specify a mandatory prop for IAM policy document to use in AWS::SNS::TopicPolicy

fixes aws#7934
@ap00rv ap00rv marked this pull request as ready for review September 27, 2020 01:31
@gitpod-io
Copy link

gitpod-io bot commented Oct 15, 2020

Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here. I was really reticent to make this a required property and then in the future want to go back to making it optional which would require a breaking change. It looks like the issue here is that we don't JSONify the PolicyDocument before passing it to the L1. So we can make the property optional, then call toJSON on this.policyDocument so that the default value is correctly passed to the template.

Ignore me 🤣

packages/@aws-cdk/aws-sns/lib/policy.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-sns/lib/policy.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-sns/lib/policy.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-sns/lib/policy.ts Outdated Show resolved Hide resolved
@MrArnoldPalmer MrArnoldPalmer self-requested a review March 15, 2021 23:49
@MrArnoldPalmer
Copy link
Contributor

Actually I'm dismissing that review as that still doesn't result in an empty policy document in the template. Passing an empty JSON object also doesn't work as then it fails at deploy time. It does look like there is no sensible default we could provide for the policy document so required is the way to go. Just gonna double confirm that though.

MrArnoldPalmer
MrArnoldPalmer previously approved these changes Mar 16, 2021
Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

@mergify mergify bot dismissed MrArnoldPalmer’s stale review March 16, 2021 00:16

Pull request has been modified.

MrArnoldPalmer
MrArnoldPalmer previously approved these changes Mar 16, 2021
@MrArnoldPalmer MrArnoldPalmer added the pr/do-not-merge This PR should not be merged at this time. label Mar 16, 2021
@mergify mergify bot dismissed MrArnoldPalmer’s stale review March 16, 2021 15:46

Pull request has been modified.

@github-actions github-actions bot added the @aws-cdk/aws-sns Related to Amazon Simple Notification Service label Mar 16, 2021
@MrArnoldPalmer MrArnoldPalmer removed the pr/do-not-merge This PR should not be merged at this time. label Mar 16, 2021
MrArnoldPalmer
MrArnoldPalmer previously approved these changes Mar 16, 2021
Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the construct is in fact usable now, we can't break users by adding a new required property to input. It does make sense to still add this property to allow users to pass existing PolicyDocuments/Statements etc, so I just changed it to be optional and added an additional test to prevent future breakage of the topicPolicy.document.addStatements workflow.

@MrArnoldPalmer MrArnoldPalmer changed the title fix(sns): enable creating instance of TopicPolicy fix(sns): enable passing PolicyDocument to TopicPolicy Mar 16, 2021
@MrArnoldPalmer MrArnoldPalmer changed the title fix(sns): enable passing PolicyDocument to TopicPolicy feat(sns): enable passing PolicyDocument to TopicPolicy Mar 16, 2021
@mergify mergify bot dismissed MrArnoldPalmer’s stale review March 16, 2021 16:42

Pull request has been modified.

MrArnoldPalmer
MrArnoldPalmer previously approved these changes Mar 16, 2021
@mergify mergify bot dismissed MrArnoldPalmer’s stale review March 16, 2021 17:15

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Mar 17, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 331dcaf
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Mar 17, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 0d9c300 into aws:master Mar 17, 2021
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Mar 17, 2021
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*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Mar 18, 2021
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*
@ap00rv ap00rv deleted the sns-policy-fix branch March 31, 2021 13:56
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-sns Related to Amazon Simple Notification Service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SNS Topic Policy can't be created and synth'd
3 participants