const pulumiProgram = async (content) => {
const siteBucket = new aws.s3.Bucket("s3-website-bucket", {
acl:"public-read",
website: {
indexDocument: "index.html",
},
});
const bucketOwnershipControls = new aws.s3.BucketOwnershipControls("bucketControls", {
bucket: siteBucket.id,
rule: {
objectOwnership: "BucketOwnerPreferred"
}
});
new aws.s3.BucketObject("index", {
bucket: siteBucket.id,
content: content,
key: "index.html",
contentType: "text/html; charset=utf-8",
});
new aws.s3.BucketPolicy("bucketPolicy", {
bucket: siteBucket.id,
policy: siteBucket.id.apply(id => JSON.stringify({
Version: "2012-10-17",
Statement: [{
Effect: "Allow",
Principal: "*",
Action: ["s3:GetObject"],
Resource: [
arn:aws:s3:::${id}/*
],
}],
})),
});
I have this code for creating an s3 bucket but it keeps telling me that I don't have access to add a permission to the bucket. I tried adding an ACL "pubic-read" but it still gives me this error:
* Error creating S3 bucket: InvalidBucketAclWithObjectOwnership: Bucket cannot have ACLs set with ObjectOwnership's BucketOwnerEnforced setting