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

DefaultS3Props with new Lifecycle Policy produces errors when versioning overridden #80

Closed
mobri2a opened this issue Sep 25, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mobri2a
Copy link

mobri2a commented Sep 25, 2020

Creating BucketProps from core Defaults3Props, then modifying to suit: disable versioning. Causes an error: Cannot use 'noncurrent' rules on a nonversioned bucket. It appears that a default lifecycle policy was added in 1.64.0. For customers that may have used the example code below prior to 1.64.0, this will cause their stack to fail.

Reproduction Steps

let bucketprops = DefaultS3Props();

ArtifactBucketCfg = overrideProps(ArtifactBucketCfg, {
    serverAccessLogsPrefix: 'access-logs',
    versioned: false
})

const bktArtifact = new s3.Bucket(this, "ArtifactBucket");

Error Log

Cannot use 'noncurrent' rules on a nonversioned bucket

Environment

  • CDK CLI Version : 1.64.0
  • CDK Framework Version: 1.64.0
  • AWS Solutions Constructs Version : 1.64.0
  • OS : OS/X
  • Language : Typescript

Other


This is 🐛 Bug Report

@mobri2a mobri2a added bug Something isn't working needs-triage The issue or PR still needs to be triaged labels Sep 25, 2020
@hnishar hnishar added in-progress This issue is being actively worked on and removed needs-triage The issue or PR still needs to be triaged labels Sep 25, 2020
@hnishar hnishar self-assigned this Sep 25, 2020
@hnishar hnishar removed the in-progress This issue is being actively worked on label Sep 26, 2020
@hnishar
Copy link
Contributor

hnishar commented Sep 26, 2020

mobri2a@ Good find! The fix has been pushed out in the latest release v1.64.1, for proof see this test case with versioning disabled which does not have the default life cycle policy and this test case with default versioning enabled which has the default life cycle policy.

For future reference, we do not recommend using the default props directly from the core package in the application code unless absolutely necessary. In which case, be aware to use the build function, if available. For instance, in this case, use buildS3Bucket function instead of DefaultS3Props

@hnishar hnishar closed this as completed Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants