Skip to content

Bucket: no objectOwnership prop (ACL-disabled buckets need the raw provider resource) #131

Description

@so0k

BucketProps has no objectOwnership, so there is no way to create an ACL-disabled bucket through the L2.

new aws.storage.Bucket(this, "History", {
  bucketName: "example-tfmigrate",
  objectOwnership: aws.storage.ObjectOwnership.BUCKET_OWNER_ENFORCED,
});
// error TS2353: Object literal may only specify known properties,
// and 'objectOwnership' does not exist in type 'BucketProps'.
// error TS2339: Property 'ObjectOwnership' does not exist on type
// 'typeof import(".../lib/aws/storage/index")'.

Current workaround

import { s3BucketOwnershipControls } from "@cdktn/provider-aws";

new s3BucketOwnershipControls.S3BucketOwnershipControls(this, "Ownership", {
  bucket: bucket.bucketName,
  rule: { objectOwnership: "BucketOwnerEnforced" },
});

Why it matters

BucketOwnerEnforced disables ACLs entirely and is what AWS recommends for new buckets — it has been the default for buckets created in the console since April 2023. A bucket whose access is governed purely by policies (as opposed to ACLs) is the common case, so needing the raw provider resource for it is a sharp edge.

aws-cdk models this as ObjectOwnership on BucketProps, which would be the natural shape here.

Observed on terraconstructs@0.2.12.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions