When a bucket is initialised without either transitionDate or transitionAfter being set in lifecycleRules, the stack will build successfully but fail to deploy. Similarly, if both transitionDate and transitionAfter are set, it will fail to deploy as well.
Expected Behavior
Should throw an error when both transitionDate and transitionAfter are undefined, or both are defined.
Current Behavior
Build successfully, and got errors below during deployment
SampleBucket: creating CloudFormation changeset...
1:56:12 pm | CREATE_FAILED | AWS::S3::Bucket | sampleBucket
Exactly one of TransitionDate and TransitionInDays must be specified
β SampleBucket failed: Error: The stack named sampleBucket failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Exactly one of TransitionDate and TransitionInDays must be specified
at prepareAndExecuteChangeSet (/Users/cdk/sample/node_modules/aws-cdk/lib/api/deploy-stack.ts:386:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at deployStack2 (/Users/cdk/sample/node_modules/aws-cdk/lib/cdk-toolkit.ts:240:24)
at /Users/cdk/sample/node_modules/aws-cdk/lib/deploy.ts:39:11
at run (/Users/cdk/sample/node_modules/p-queue/dist/index.js:163:29)
β Deployment failed: Error: Stack Deployments Failed: Error: The stack named sampleBucket failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Exactly one of TransitionDate and TransitionInDays must be specified
at deployStacks (/Users/cdk/sample/node_modules/aws-cdk/lib/deploy.ts:61:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at CdkToolkit.deploy (/Users/cdk/sample/node_modules/aws-cdk/lib/cdk-toolkit.ts:312:7)
at initCommandLine (/Users/cdk/sample/node_modules/aws-cdk/lib/cli.ts:349:12)
Stack Deployments Failed: Error: The stack named sampleBucket failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Exactly one of TransitionDate and TransitionInDays must be specified
Thanks for the report and your PR @Damon1024, this is definitely something we should try to throw at synth. We've given an initial review to the PR, check it out so we can try to merge this soon! π
Describe the bug
When a bucket is initialised without either transitionDate or transitionAfter being set in lifecycleRules, the stack will build successfully but fail to deploy. Similarly, if both transitionDate and transitionAfter are set, it will fail to deploy as well.
Expected Behavior
Should throw an error when both transitionDate and transitionAfter are undefined, or both are defined.
Current Behavior
Build successfully, and got errors below during deployment
Reproduction Steps
Deploy the stack below
Possible Solution
Add validation to cdk
Additional Information/Context
No response
CDK CLI Version
2.41.0
Framework Version
2.41.0
Node.js Version
16.13.1
OS
Linux
Language
Typescript
Language Version
TypeScript(4.7.4)
Other information
No response