diff --git a/aws-js-s3-folder-component/README.md b/aws-js-s3-folder-component/README.md index adab70d89..c0d7b9445 100644 --- a/aws-js-s3-folder-component/README.md +++ b/aws-js-s3-folder-component/README.md @@ -39,7 +39,7 @@ with `***`. Type Name Status Info + pulumi:pulumi:Stack aws-js-s3-folder-component-website-component-testing created + └─ examples:S3Folder pulumi-static-site created - + ├─ aws:s3:Bucket pulumi-static-site created + + ├─ aws:s3:BucketV2 pulumi-static-site created + ├─ aws:s3:BucketPolicy bucketPolicy created + ├─ aws:s3:BucketObject favicon.png created + └─ aws:s3:BucketObject index.html created diff --git a/aws-js-s3-folder-component/s3folder.js b/aws-js-s3-folder-component/s3folder.js index 3c202eb2f..dde1d177a 100644 --- a/aws-js-s3-folder-component/s3folder.js +++ b/aws-js-s3-folder-component/s3folder.js @@ -11,12 +11,15 @@ class S3Folder extends pulumi.ComponentResource { super("pulumi:examples:S3Folder", bucketName, {}, opts); // Register this component with name pulumi:examples:S3Folder // Create a bucket and expose a website index document - let siteBucket = new aws.s3.Bucket(bucketName, { - website: { - indexDocument: "index.html", + let siteBucket = new aws.s3.BucketV2(bucketName, {}, { parent: this }); // specify resource parent + + let websiteConfig = new aws.s3.BucketWebsiteConfigurationV2("s3-website-bucket-config", { + bucket: siteBucket.id, + indexDocument: { + suffix: "index.html", }, - }, { parent: this }); // specify resource parent - + }, { parent: this }); + const publicAccessBlock = new aws.s3.BucketPublicAccessBlock("public-access-block", { bucket: siteBucket.id, blockPublicAcls: false, @@ -39,7 +42,7 @@ class S3Folder extends pulumi.ComponentResource { }, { parent: this, dependsOn: publicAccessBlock }); // specify resource parent this.bucketName = siteBucket.bucket; - this.websiteUrl = siteBucket.websiteEndpoint; + this.websiteUrl = websiteConfig.websiteEndpoint; // Register output properties for this component this.registerOutputs({