fix the arn interpolation for real.
MODIFY
aws-ts-static-website/index.ts
aws-ts-static-website/index.ts
@@ -296,17 +296,17 @@ function createWWWAliasRecord(targetDomain: string, distribution: aws.cloudfront
}
const bucketPolicy = new aws.s3.BucketPolicy("bucketPolicy", {
- bucket: contentBucket.id, // refer to the bucket created earlier
- policy: contentBucket.arn.apply(bucketArn => JSON.stringify({
+ bucket: siteBucket.id, // refer to the bucket created earlier
+ policy: pulumi.all([originAccessIdentity.iamArn, contentBucket.arn]).apply(([oaiArn, bucketArn]) =>JSON.stringify({
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
- Principal: originAccessIdentity.iamArn, // Only allow Cloudfront read access.
+ Principal: {
+ AWS: oaiArn
+ }, // Only allow Cloudfront read access.
Action: ["s3:GetObject"],
- Resource: [
- `${bucketArn}/*`, // Give Cloudfront access to the entire bucket.
- ],
+ Resource: [`${bucketArn}/*`], // Give Cloudfront access to the entire bucket.
},
],
}))

fix the arn interpolation for real.