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: Add a construct to ease S3 bucket creation #635

Merged
merged 1 commit into from
Jun 24, 2021

Conversation

akash1810
Copy link
Member

@akash1810 akash1810 commented Jun 24, 2021

What does this change?

Guardian best practice is to retain S3 buckets as buckets share a global namespace. GuS3Bucket will set the correct policy on the bucket to simplify this.

See:

Does this change require changes to existing projects or CDK CLI?

No.

Does this change require changes to the library documentation?

Yes and it has been added.

How to test

See the added tests?

How can we measure success?

It is easier to create Guardian flavoured buckets.

Have we considered potential risks?

n/a

@akash1810 akash1810 requested a review from a team June 24, 2021 09:34
import { GuMigratingS3Bucket } from "./migrating-bucket";

describe("The GuMigratingS3Bucket construct", () => {
it("should auto-generate the logicalId by default", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we'd ever want this construct to create a new logical id (since it is explicitly for migrating existing buckets)? Perhaps we could require the prop (or throw) instead of allowing this to happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! I actually don't think GuMigratingS3Bucket is in line with our other constructs, which are typically "Guardian flavoured versions of AWS constructs".

A Guardian flavoured bucket would be a tagged bucket with a retain policy. What if GuMigratingS3Bucket became GuS3Bucket, setting these props?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated now. The diff is tiny as a result! 🎉

Guardian best practice is to retain S3 buckets as buckets share a global namespace.
`GuS3Bucket` will set the correct policy on the bucket to simplify this.

See:
  - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
@akash1810 akash1810 force-pushed the aa-migrating-s3-construct branch from 5d3d094 to 9740afb Compare June 24, 2021 12:42
@akash1810 akash1810 changed the title feat: Add a construct to ease S3 bucket migration feat: Add a construct to ease S3 bucket creation Jun 24, 2021
@akash1810 akash1810 merged commit 5738fbc into main Jun 24, 2021
@akash1810 akash1810 deleted the aa-migrating-s3-construct branch June 24, 2021 15:53
@github-actions
Copy link
Contributor

🎉 This PR is included in version 19.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants