Skip to content

Commit 2569317

Browse files
committed
aws_s3: Don't set ACL by default since ACLs are disabled by default for buckets created since 2023
Setting an ACL throws an error when uploading to a bucket with ACLs disabled when the bucket is in another account. The former default 'private' is accepted by buckets in the same account but is a no-op
1 parent 813e390 commit 2569317

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

internal/impl/aws/s3/output.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ output:
313313
}
314314
})...).
315315
Description("The object canned ACL value.").
316-
Default(string(types.ObjectCannedACLPrivate)).
316+
Default("").
317317
Advanced(),
318318
service.NewBatchPolicyField(s3oFieldBatching),
319319
).
@@ -473,7 +473,6 @@ func (a *amazonS3Writer) WriteBatch(wctx context.Context, msg service.MessageBat
473473
WebsiteRedirectLocation: websiteRedirectLocation,
474474
StorageClass: tmtypes.StorageClass(storageClass),
475475
Metadata: metadata,
476-
ACL: tmtypes.ObjectCannedACL(a.conf.ObjectCannedACL),
477476
}
478477

479478
// Prepare tags, escaping keys and values to ensure they're valid query string parameters.
@@ -498,6 +497,10 @@ func (a *amazonS3Writer) WriteBatch(wctx context.Context, msg service.MessageBat
498497
uploadInput.ChecksumAlgorithm = tmtypes.ChecksumAlgorithm(a.conf.ChecksumAlgorithm)
499498
}
500499

500+
if a.conf.ObjectCannedACL != "" {
501+
uploadInput.ACL = tmtypes.ObjectCannedACL(a.conf.ObjectCannedACL)
502+
}
503+
501504
// NOTE: This overrides the ServerSideEncryption set above. We need this to preserve
502505
// backwards compatibility, where it is allowed to only set kms_key_id in the config and
503506
// the ServerSideEncryption value of "aws:kms" is implied.

0 commit comments

Comments
 (0)