From 07c8dcdd91a97c22dc5e0173cc526771cdff6fcf Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:37:31 -0400 Subject: [PATCH 01/17] Update static-website-aws-typescript --- static-website-aws-typescript/index.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/static-website-aws-typescript/index.ts b/static-website-aws-typescript/index.ts index f4ce7ac04..9aa919c01 100644 --- a/static-website-aws-typescript/index.ts +++ b/static-website-aws-typescript/index.ts @@ -9,11 +9,12 @@ const indexDocument = config.get("indexDocument") || "index.html"; const errorDocument = config.get("errorDocument") || "error.html"; // Create an S3 bucket and configure it as a website. -const bucket = new aws.s3.Bucket("bucket", { - website: { - indexDocument: indexDocument, - errorDocument: errorDocument, - }, +const bucket = new aws.s3.BucketV2("bucket"); + +const bucketWebsite = new aws.s3.BucketWebsiteConfigurationV2("bucketWebsite", { + bucket: bucket.bucket, + indexDocument: {suffix: indexDocument}, + errorDocument: {key: errorDocument}, }); // Configure ownership controls for the new S3 bucket @@ -42,7 +43,7 @@ const cdn = new aws.cloudfront.Distribution("cdn", { enabled: true, origins: [{ originId: bucket.arn, - domainName: bucket.websiteEndpoint, + domainName: bucketWebsite.websiteEndpoint, customOriginConfig: { originProtocolPolicy: "http-only", httpPort: 80, @@ -90,7 +91,7 @@ const cdn = new aws.cloudfront.Distribution("cdn", { }); // Export the URLs and hostnames of the bucket and distribution. -export const originURL = pulumi.interpolate`http://${bucket.websiteEndpoint}`; -export const originHostname = bucket.websiteEndpoint; +export const originURL = pulumi.interpolate`http://${bucketWebsite.websiteEndpoint}`; +export const originHostname = bucketWebsite.websiteEndpoint; export const cdnURL = pulumi.interpolate`https://${cdn.domainName}`; export const cdnHostname = cdn.domainName; From 4335d9156d00b19f069e4d8ab122436d72c3e4d9 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:38:40 -0400 Subject: [PATCH 02/17] Update aws-python template --- aws-python/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-python/__main__.py b/aws-python/__main__.py index dfb3e5a12..f94233fe0 100644 --- a/aws-python/__main__.py +++ b/aws-python/__main__.py @@ -4,7 +4,7 @@ from pulumi_aws import s3 # Create an AWS resource (S3 Bucket) -bucket = s3.Bucket('my-bucket') +bucket = s3.BucketV2('my-bucket') # Export the name of the bucket pulumi.export('bucket_name', bucket.id) From debb22dbb072ffc2465285dd64ac792429496830 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:39:06 -0400 Subject: [PATCH 03/17] Update aws-visualbasic --- aws-visualbasic/Program.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-visualbasic/Program.vb b/aws-visualbasic/Program.vb index 6468e43b2..5f8caa825 100644 --- a/aws-visualbasic/Program.vb +++ b/aws-visualbasic/Program.vb @@ -8,7 +8,7 @@ Module Program Private Function Infra() As IDictionary(Of String,Object) ' Create an AWS resource (S3 Bucket) - Dim bucket = New Bucket("my-bucket") + Dim bucket = New BucketV2("my-bucket") ' Export the name of the bucket Dim outputs = New Dictionary(Of String, Object) From 5ddc01932bf93d1e62c29b7d20153923899e7a1c Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:39:33 -0400 Subject: [PATCH 04/17] Update aws-javascript --- aws-javascript/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-javascript/index.js b/aws-javascript/index.js index 071072312..d83dbe1b6 100644 --- a/aws-javascript/index.js +++ b/aws-javascript/index.js @@ -4,7 +4,7 @@ const aws = require("@pulumi/aws"); const awsx = require("@pulumi/awsx"); // Create an AWS resource (S3 Bucket) -const bucket = new aws.s3.Bucket("my-bucket"); +const bucket = new aws.s3.BucketV2("my-bucket"); // Export the name of the bucket exports.bucketName = bucket.id; From 21b24dd4aab6aca5063352891d8787d316e0aa03 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:39:58 -0400 Subject: [PATCH 05/17] Update aws-scala --- aws-scala/src/main/scala/Main.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws-scala/src/main/scala/Main.scala b/aws-scala/src/main/scala/Main.scala index eb07090ab..f0fd8abdf 100644 --- a/aws-scala/src/main/scala/Main.scala +++ b/aws-scala/src/main/scala/Main.scala @@ -1,14 +1,14 @@ package myproject import com.pulumi.{Context, Pulumi} -import com.pulumi.aws.s3.Bucket +import com.pulumi.aws.s3.BucketV2 object App { def main(args: Array[String]): Unit = { Pulumi.run { (ctx: Context) => // Create an AWS resource (S3 Bucket) - var bucket = new Bucket("my-bucket"); + var bucket = new BucketV2("my-bucket"); // Export the name of the bucket ctx.`export`("bucketName", bucket.bucket()) From b18ca915022a1af22832a8b061ee52fae1c233c9 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:40:18 -0400 Subject: [PATCH 06/17] Update aws-fsharp --- aws-fsharp/Program.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-fsharp/Program.fs b/aws-fsharp/Program.fs index f7211171f..0dc51596d 100644 --- a/aws-fsharp/Program.fs +++ b/aws-fsharp/Program.fs @@ -6,7 +6,7 @@ open Pulumi.Aws.S3 let infra () = // Create an AWS resource (S3 Bucket) - let bucket = Bucket "my-bucket" + let bucket = BucketV2 "my-bucket" // Export the name of the bucket dict [("bucketName", bucket.Id :> obj)] From ea3339c3913ba44993457846002c9e079eff13ce Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:40:54 -0400 Subject: [PATCH 07/17] Update aws-csharp --- aws-csharp/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-csharp/Program.cs b/aws-csharp/Program.cs index 48a715a15..b099b9f51 100644 --- a/aws-csharp/Program.cs +++ b/aws-csharp/Program.cs @@ -5,7 +5,7 @@ return await Deployment.RunAsync(() => { // Create an AWS resource (S3 Bucket) - var bucket = new Bucket("my-bucket"); + var bucket = new BucketV2("my-bucket"); // Export the name of the bucket return new Dictionary From 75992b0cd3ccc6a2932c971f5b7da01f1ba29195 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:41:13 -0400 Subject: [PATCH 08/17] Update aws-go --- aws-go/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-go/main.go b/aws-go/main.go index af8af41d6..da1806b3a 100644 --- a/aws-go/main.go +++ b/aws-go/main.go @@ -8,7 +8,7 @@ import ( func main() { pulumi.Run(func(ctx *pulumi.Context) error { // Create an AWS resource (S3 Bucket) - bucket, err := s3.NewBucket(ctx, "my-bucket", nil) + bucket, err := s3.NewBucketV2(ctx, "my-bucket", nil) if err != nil { return err } From 29bb3d85c0bc76a1468fd305a8589ffa697df0f4 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:41:41 -0400 Subject: [PATCH 09/17] Update aws-java --- aws-java/src/main/java/myproject/App.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws-java/src/main/java/myproject/App.java b/aws-java/src/main/java/myproject/App.java index 2a01bb7e2..950b3f2e9 100644 --- a/aws-java/src/main/java/myproject/App.java +++ b/aws-java/src/main/java/myproject/App.java @@ -2,12 +2,12 @@ import com.pulumi.Pulumi; import com.pulumi.core.Output; -import com.pulumi.aws.s3.Bucket; +import com.pulumi.aws.s3.BucketV2; public class App { public static void main(String[] args) { Pulumi.run(ctx -> { - var bucket = new Bucket("my-bucket"); + var bucket = new BucketV2("my-bucket"); ctx.export("bucketName", bucket.bucket()); }); } From 350b41d9bd1a0df7e2794335ebaa337b3c2bfd48 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:42:05 -0400 Subject: [PATCH 10/17] Update aws-typescript --- aws-typescript/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-typescript/index.ts b/aws-typescript/index.ts index e38672c16..7f3d91af9 100644 --- a/aws-typescript/index.ts +++ b/aws-typescript/index.ts @@ -3,7 +3,7 @@ import * as aws from "@pulumi/aws"; import * as awsx from "@pulumi/awsx"; // Create an AWS resource (S3 Bucket) -const bucket = new aws.s3.Bucket("my-bucket"); +const bucket = new aws.s3.BucketV2("my-bucket"); // Export the name of the bucket export const bucketName = bucket.id; From 44ccdd220eca73b3fa99d4144673c96e3a08891e Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 12:42:33 -0400 Subject: [PATCH 11/17] Update aws-yaml --- aws-yaml/Pulumi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-yaml/Pulumi.yaml b/aws-yaml/Pulumi.yaml index 537af19eb..afe76c3a6 100644 --- a/aws-yaml/Pulumi.yaml +++ b/aws-yaml/Pulumi.yaml @@ -12,7 +12,7 @@ template: resources: # Create an AWS resource (S3 Bucket) my-bucket: - type: aws:s3:Bucket + type: aws:s3:BucketV2 outputs: # Export the name of the bucket From 5fcbbdeb289dbb0bd696eb95328f153b16c88cfe Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 13:08:24 -0400 Subject: [PATCH 12/17] Update static-website-aws-go --- static-website-aws-go/main.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/static-website-aws-go/main.go b/static-website-aws-go/main.go index f8112446e..514c451b9 100644 --- a/static-website-aws-go/main.go +++ b/static-website-aws-go/main.go @@ -29,10 +29,18 @@ func main() { } // Create an S3 bucket and configure it as a website. - bucket, err := s3.NewBucket(ctx, "bucket", &s3.BucketArgs{ - Website: &s3.BucketWebsiteArgs{ - IndexDocument: pulumi.String(indexDocument), - ErrorDocument: pulumi.String(errorDocument), + bucket, err := s3.NewBucketV2(ctx, "bucket", nil) + if err != nil { + return err + } + + bucketWebsite, err := s3.NewBucketWebsiteConfigurationV2(ctx, "bucket", &s3.BucketWebsiteConfigurationV2Args{ + Bucket: bucket.Bucket, + IndexDocument: s3.BucketWebsiteConfigurationV2IndexDocumentArgs{ + Suffix: pulumi.String(indexDocument), + }, + ErrorDocument: s3.BucketWebsiteConfigurationV2ErrorDocumentArgs{ + Key: pulumi.String(errorDocument), }, }) if err != nil { @@ -75,7 +83,7 @@ func main() { Origins: cloudfront.DistributionOriginArray{ &cloudfront.DistributionOriginArgs{ OriginId: bucket.Arn, - DomainName: bucket.WebsiteEndpoint, + DomainName: bucketWebsite.WebsiteEndpoint, CustomOriginConfig: &cloudfront.DistributionOriginCustomOriginConfigArgs{ OriginProtocolPolicy: pulumi.String("http-only"), HttpPort: pulumi.Int(80), @@ -131,8 +139,8 @@ func main() { } // Export the URLs and hostnames of the bucket and distribution. - ctx.Export("originURL", pulumi.Sprintf("http://%s", bucket.WebsiteEndpoint)) - ctx.Export("originHostname", bucket.WebsiteEndpoint) + ctx.Export("originURL", pulumi.Sprintf("http://%s", bucketWebsite.WebsiteEndpoint)) + ctx.Export("originHostname", bucketWebsite.WebsiteEndpoint) ctx.Export("cdnURL", pulumi.Sprintf("https://%s", cdn.DomainName)) ctx.Export("cdnHostname", cdn.DomainName) return nil From 61502def2bbab24c051df6e04b7a15b55be00243 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 13:13:49 -0400 Subject: [PATCH 13/17] Update static-website-aws-csharp --- static-website-aws-csharp/Program.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/static-website-aws-csharp/Program.cs b/static-website-aws-csharp/Program.cs index 2eeba5d9f..c4acdcf7c 100644 --- a/static-website-aws-csharp/Program.cs +++ b/static-website-aws-csharp/Program.cs @@ -12,7 +12,7 @@ var errorDocument = config.Get("errorDocument") ?? "error.html"; // Create an S3 bucket and configure it as a website. - var bucket = new Aws.S3.Bucket("bucket", new() + var bucket = new Aws.S3.BucketV2("bucket", new() { Website = new Aws.S3.Inputs.BucketWebsiteArgs { @@ -21,6 +21,19 @@ }, }); + var bucketWebsite = new Aws.S3.BucketWebsiteConfigurationV2("bucket", new() + { + Bucket = bucket.Bucket, + IndexDocument = new () + { + Suffix = indexDocument, + }, + ErrorDocument = new () + { + Key = errorDocument, + }, + }); + // Configure ownership controls for the new S3 bucket var ownershipControls = new Aws.S3.BucketOwnershipControls("ownership-controls", new() { @@ -44,8 +57,8 @@ Path = path, BucketName = bucket.BucketName, Acl = "public-read", - }, new ComponentResourceOptions { - DependsOn = { + }, new ComponentResourceOptions { + DependsOn = { ownershipControls, publicAccessBlock } @@ -127,7 +140,7 @@ // Export the URLs and hostnames of the bucket and distribution. return new Dictionary { - ["originURL"] = Output.Format($"http://{bucket.WebsiteEndpoint}"), + ["originURL"] = Output.Format($"http://{bucketWebsite.WebsiteEndpoint}"), ["originHostname"] = bucket.WebsiteEndpoint, ["cdnURL"] = Output.Format($"https://{cdn.DomainName}"), ["cdnHostname"] = cdn.DomainName, From e71e6d46aa572be51d99e9f6cf6a9f4309149641 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 13:15:43 -0400 Subject: [PATCH 14/17] Update static-website-aws-python --- static-website-aws-python/__main__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/static-website-aws-python/__main__.py b/static-website-aws-python/__main__.py index 6d951cd5c..5da4f3736 100644 --- a/static-website-aws-python/__main__.py +++ b/static-website-aws-python/__main__.py @@ -9,7 +9,7 @@ error_document = config.get("errorDocument") or "error.html" # Create an S3 bucket and configure it as a website. -bucket = aws.s3.Bucket( +bucket = aws.s3.BucketV2( "bucket", website={ "index_document": index_document, @@ -17,6 +17,13 @@ }, ) +bucket_website = aws.s3.BucketWebsiteConfigurationV2( + "bucket", + bucket=bucket.bucket, + index_document={"suffix": index_document}, + error_document={"key": error_document}, +) + # Set ownership controls for the new bucket ownership_controls = aws.s3.BucketOwnershipControls( "ownership-controls", @@ -49,7 +56,7 @@ origins=[ { "origin_id": bucket.arn, - "domain_name": bucket.website_endpoint, + "domain_name": bucket_website.website_endpoint, "custom_origin_config": { "origin_protocol_policy": "http-only", "http_port": 80, @@ -100,7 +107,7 @@ ) # Export the URLs and hostnames of the bucket and distribution. -pulumi.export("originURL", pulumi.Output.concat("http://", bucket.website_endpoint)) +pulumi.export("originURL", pulumi.Output.concat("http://", bucket_website.website_endpoint)) pulumi.export("originHostname", bucket.website_endpoint) pulumi.export("cdnURL", pulumi.Output.concat("https://", cdn.domain_name)) pulumi.export("cdnHostname", cdn.domain_name) From 9935cc11a061f4767e678282812648a7c476ba17 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 20 Sep 2024 13:17:31 -0400 Subject: [PATCH 15/17] Update static-website-aws-yaml --- static-website-aws-yaml/Pulumi.yaml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/static-website-aws-yaml/Pulumi.yaml b/static-website-aws-yaml/Pulumi.yaml index 411b81914..3eb23a5f7 100644 --- a/static-website-aws-yaml/Pulumi.yaml +++ b/static-website-aws-yaml/Pulumi.yaml @@ -34,11 +34,16 @@ resources: # Create an S3 bucket and configure it as a website. bucket: + type: aws:s3:BucketV2 + + bucketWebsite: properties: - website: - errorDocument: ${errorDocument} - indexDocument: ${indexDocument} - type: aws:s3:Bucket + bucket: ${bucket.bucket} + errorDocument: + suffix: ${errorDocument} + indexDocument: + key: ${indexDocument} + type: aws:s3:BucketWebsiteConfigurationV2 # Assign ownership controls to the new S3 bucket ownership-controls: @@ -74,7 +79,7 @@ resources: enabled: true origins: - originId: ${bucket.arn} - domainName: ${bucket.websiteEndpoint} + domainName: ${bucketWebsite.websiteEndpoint} customOriginConfig: originProtocolPolicy: http-only httpPort: 80 @@ -113,7 +118,7 @@ resources: # Export the URLs and hostnames of the bucket and distribution. outputs: - originURL: http://${bucket.websiteEndpoint} - originHostname: ${bucket.websiteEndpoint} + originURL: http://${bucketWebsite.websiteEndpoint} + originHostname: ${bucketWebsite.websiteEndpoint} cdnURL: https://${cdn.domainName} cdnHostname: ${cdn.domainName} From d20285f63ba2223d8a7e5a9214168ad45495cb32 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Fri, 27 Sep 2024 15:47:31 -0400 Subject: [PATCH 16/17] Fix typo in the static-website-aws-csharp template --- static-website-aws-csharp/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static-website-aws-csharp/Program.cs b/static-website-aws-csharp/Program.cs index c4acdcf7c..01dcffc7a 100644 --- a/static-website-aws-csharp/Program.cs +++ b/static-website-aws-csharp/Program.cs @@ -55,7 +55,7 @@ var bucketFolder = new SyncedFolder.S3BucketFolder("bucket-folder", new() { Path = path, - BucketName = bucket.BucketName, + BucketName = bucket.Bucket, Acl = "public-read", }, new ComponentResourceOptions { DependsOn = { From 36d91dd97b3ac20c4a509ec6a34ee5f194e35234 Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Mon, 30 Sep 2024 17:24:49 -0400 Subject: [PATCH 17/17] Further fixes to the C# example --- static-website-aws-csharp/Program.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/static-website-aws-csharp/Program.cs b/static-website-aws-csharp/Program.cs index 01dcffc7a..5622dc3d6 100644 --- a/static-website-aws-csharp/Program.cs +++ b/static-website-aws-csharp/Program.cs @@ -12,23 +12,16 @@ var errorDocument = config.Get("errorDocument") ?? "error.html"; // Create an S3 bucket and configure it as a website. - var bucket = new Aws.S3.BucketV2("bucket", new() - { - Website = new Aws.S3.Inputs.BucketWebsiteArgs - { - IndexDocument = indexDocument, - ErrorDocument = errorDocument, - }, - }); + var bucket = new Aws.S3.BucketV2("bucket"); var bucketWebsite = new Aws.S3.BucketWebsiteConfigurationV2("bucket", new() { Bucket = bucket.Bucket, - IndexDocument = new () + IndexDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2IndexDocumentArgs { Suffix = indexDocument, }, - ErrorDocument = new () + ErrorDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs { Key = errorDocument, }, @@ -73,7 +66,7 @@ new Aws.CloudFront.Inputs.DistributionOriginArgs { OriginId = bucket.Arn, - DomainName = bucket.WebsiteEndpoint, + DomainName = bucketWebsite.WebsiteEndpoint, CustomOriginConfig = new Aws.CloudFront.Inputs.DistributionOriginCustomOriginConfigArgs { OriginProtocolPolicy = "http-only",