Skip to content

Instantly share code, notes, and snippets.

@laurelmay
Created January 19, 2023 02:52
Show Gist options
  • Save laurelmay/788df029f121af14645f31152ff54e32 to your computer and use it in GitHub Desktop.
Save laurelmay/788df029f121af14645f31152ff54e32 to your computer and use it in GitHub Desktop.
---
AWSTemplateFormatVersion: "2010-09-09"
Resources:
BucketA:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockEnabled: true
# In both B and C, CloudFormation seems to create the buckets (a CreateBucket appears in
# CloudTrail and the buckets appear in the S3 console); however, it spends a very long time
# still thinking that it is creating the resources. I didn't wait to see whether this ends
# up in a failure or a success but this doesn't seem like the intended configuration.
BucketB:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockConfiguration:
ObjectLockEnabled: 'Enabled'
BucketC:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockEnabled: true
ObjectLockConfiguration:
ObjectLockEnabled: 'Enabled'
BucketD:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockEnabled: true
ObjectLockConfiguration:
ObjectLockEnabled: 'Enabled'
Rule:
DefaultRetention:
Days: 1
Mode: GOVERNANCE
# Fails to create -- "the XML you provided was not well-formatted or did not validate against our published schema"
BucketE:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockEnabled: true
ObjectLockConfiguration:
Rule:
DefaultRetention:
Days: 1
Mode: GOVERNANCE
# Fails to create -- cannot enable on existing buckets
BucketF:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockEnabled: false
ObjectLockConfiguration:
Rule:
DefaultRetention:
Days: 1
Mode: GOVERNANCE
# Fails to create -- cannot enable on existing buckets
BucketG:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockEnabled: false
ObjectLockConfiguration:
ObjectLockEnabled: 'Enabled'
Rule:
DefaultRetention:
Days: 1
Mode: GOVERNANCE
# Fails to create -- cannot enable on existing buckets
BucketH:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockConfiguration:
ObjectLockEnabled: 'Enabled'
Rule:
DefaultRetention:
Days: 1
Mode: GOVERNANCE
# Fails to create -- cannot enable on existing buckets
BucketI:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
ObjectLockConfiguration:
Rule:
DefaultRetention:
Days: 1
Mode: GOVERNANCE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment