Skip to content

Commit

Permalink
Update nx-monorepo to BucketV2
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Sep 19, 2024
1 parent f143bd3 commit af4fee9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions nx-monorepo/components/s3folder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";

export class S3Folder extends pulumi.ComponentResource {
readonly bucket: pulumi.Output<aws.s3.Bucket>;
readonly bucket: pulumi.Output<aws.s3.BucketV2>;
readonly websiteUrl: pulumi.Output<string>;

/**
Expand All @@ -14,11 +14,12 @@ export class S3Folder extends pulumi.ComponentResource {
super("pulumi:examples:S3Folder", bucketName, {}, opts);

// Create a bucket and expose a website index document
const siteBucket = new aws.s3.Bucket(bucketName, {
website: {
indexDocument: "index.html",
},
}, { parent: this }); // specify resource parent
const siteBucket = new aws.s3.BucketV2(bucketName, {}, { parent: this }); // specify resource parent

const siteBucketWebsite = new aws.s3.BucketWebsiteConfigurationV2(bucketName, {
bucket: siteBucket.bucket,
indexDocument: {suffix: "index.html"}
}, { parent: this});

const publicAccessBlock = new aws.s3.BucketPublicAccessBlock("public-access-block", {
bucket: siteBucket.id,
Expand All @@ -32,7 +33,7 @@ export class S3Folder extends pulumi.ComponentResource {
}, { parent: this, dependsOn: publicAccessBlock }); // specify resource parent

this.bucket = pulumi.output(siteBucket);
this.websiteUrl = siteBucket.websiteEndpoint;
this.websiteUrl = siteBucketWebsite.websiteEndpoint;

// Register output properties for this component
this.registerOutputs({
Expand Down

0 comments on commit af4fee9

Please sign in to comment.