Skip to content

Commit

Permalink
fix the arn interpolation for real.
Browse files Browse the repository at this point in the history
  • Loading branch information
lita committed Sep 1, 2021
1 parent a603366 commit babfc1f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions aws-ts-static-website/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,21 +296,21 @@ 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.
},
],
}))
});
}))
});

const aRecord = createAliasRecord(config.targetDomain, cdn);
if (config.includeWWW) {
Expand Down

0 comments on commit babfc1f

Please sign in to comment.