fix the toJSON apply function with Pulumi inputs
MODIFY
aws-ts-static-website/index.ts
aws-ts-static-website/index.ts
@@ -297,7 +297,7 @@ function createWWWAliasRecord(targetDomain: string, distribution: aws.cloudfront
const bucketPolicy = new aws.s3.BucketPolicy("bucketPolicy", {
bucket: contentBucket.id, // refer to the bucket created earlier
- policy: JSON.stringify({
+ policy: contentBucket.arn.apply(bucketArn => JSON.stringify({
Version: "2012-10-17",
Statement: [
{
@@ -305,11 +305,11 @@ const bucketPolicy = new aws.s3.BucketPolicy("bucketPolicy", {
Principal: originAccessIdentity.iamArn, // Only allow Cloudfront read access.
Action: ["s3:GetObject"],
Resource: [
- contentBucket.arn.apply((bucketArn: string) =>`${bucketArn}/*`), // Give Cloudfront access to the entire bucket.
+ `${bucketArn}/*`, // Give Cloudfront access to the entire bucket.
],
},
],
- })
+ }))
});
const aRecord = createAliasRecord(config.targetDomain, cdn);

fix the toJSON apply function with Pulumi inputs