-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
@aws-cdk/aws-s3Related to Amazon S3Related to Amazon S3bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1
Description
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
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
Reproduction Steps
Deploy the stack below
import { Stack, StackProps, aws_s3 as s3 } from "aws-cdk-lib";
import { Construct } from "constructs";
export class TestStack extends Stack {
bucket: s3.Bucket;
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
this.bucket = new s3.Bucket(this, "test-s3-bucket", {
lifecycleRules: [
{
transitions: [{ storageClass: s3.StorageClass.GLACIER }],
},
],
});
}
}
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
johnjunjiezhao
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-s3Related to Amazon S3Related to Amazon S3bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1