cloudformation-coverage-roadmap icon indicating copy to clipboard operation
cloudformation-coverage-roadmap copied to clipboard

Standalone S3 Lifecycle Rule for ExpiredObjectDeleteMarker=true does not work

Open noslowerdna opened this issue 3 years ago • 5 comments

Name of the resource

AWS::S3::Bucket

Resource Name

No response

Issue Description

Using the AWS console or CLI we can create a minimal S3 bucket lifecycle rule that sets ExpiredObjectDeleteMarker to true, with no other functionality included.

Console

Screen Shot 2022-03-23 at 9 54 56 AM

CLI

aws s3api put-bucket-lifecycle-configuration --bucket some-test-bucket \
--lifecycle-configuration '{"Rules":[{"Expiration":{"ExpiredObjectDeleteMarker":true},"ID":"Cleanup Delete Markers","Filter":{},"Status":"Enabled"}]}'

Both methods result in the following rule creation.

Console

Screen Shot 2022-03-25 at 11 03 07 AM

CLI

aws s3api get-bucket-lifecycle-configuration --bucket some-test-bucket
{
    "Rules": [
        {
            "Expiration": {
                "ExpiredObjectDeleteMarker": true
            },
            "ID": "Cleanup Delete Markers",
            "Filter": {},
            "Status": "Enabled"
        }
    ]
}

However based on our recent experience and confirmed by AWS Support, the same standalone ExpiredObjectDeleteMarker=true lifecycle rule cannot be created using CloudFormation. Feature #132 (status: Shipped) incorrectly indicates that it can.

Expected Behavior

The CloudFormation stack creation or update succeeds and applies a minimal ExpiredObjectDeleteMarker=true lifecycle rule to the S3 bucket.

Observed Behavior

The CloudFormation stack creation or update fails with this error,

"At least one of [ExpirationDate,ExpirationInDays,AbortIncompleteMultipartUpload,Transition,Transitions,NoncurrentVersionExpirationInDays,NoncurrentVersionTransition,NoncurrentVersionTransitions,NoncurrentVersionExpiration] needs to be specified"

Test Cases

Resources:
  S3Bucket:
    Properties:
      LifecycleConfiguration:
        Rules:
        - Id: Cleanup Delete Markers
          ExpiredObjectDeleteMarker: true
          Status: Enabled

Other Details

No response

noslowerdna avatar Mar 25 '22 16:03 noslowerdna