From ee7bd252d0437d4e69bceb9fbcef1a86ccde28c5 Mon Sep 17 00:00:00 2001 From: Josh Kodroff Date: Sun, 9 Nov 2025 21:59:24 -0500 Subject: [PATCH] Remove JavaScript examples from documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove JavaScript code examples from all documentation sections except the main JavaScript/Node.js language page (languages-sdks/javascript). TypeScript is now the recommended and primary language for Node.js examples throughout the documentation. Changes include: - Get-started tutorials (AWS, GCP, Kubernetes, Azure): 14 files - Migration guides (Terraform, CloudFormation, Kubernetes, Import): 4 files - Building/extending guides (Components, Packages): 2 files - Automation API documentation: 2 files - Concepts documentation (hidediffs): 1 file Total: 25 files modified This change improves consistency and reduces maintenance burden by focusing on TypeScript as the primary Node.js language, while still acknowledging JavaScript support in the main language documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- content/docs/iac/automation-api/_index.md | 6 +- .../getting-started-automation-api.md | 20 +-- .../concepts/resources/options/hidediffs.md | 10 +- content/docs/iac/get-started/aws/_index.md | 4 +- .../iac/get-started/aws/create-component.md | 120 ----------------- .../iac/get-started/aws/create-project.md | 39 +----- .../docs/iac/get-started/aws/deploy-stack.md | 4 +- .../iac/get-started/aws/modify-program.md | 13 +- .../iac/get-started/azure/review-project.md | 4 +- content/docs/iac/get-started/gcp/begin.md | 4 +- .../iac/get-started/gcp/create-project.md | 12 +- .../iac/get-started/gcp/deploy-changes.md | 42 +----- .../docs/iac/get-started/gcp/deploy-stack.md | 10 +- .../iac/get-started/gcp/modify-program.md | 27 +--- .../iac/get-started/gcp/review-project.md | 32 +---- .../docs/iac/get-started/kubernetes/begin.md | 4 +- .../get-started/kubernetes/create-project.md | 12 +- .../get-started/kubernetes/modify-program.md | 46 +------ .../get-started/kubernetes/review-project.md | 27 +--- .../components/build-a-component.md | 122 +----------------- .../building-extending/packages/schema.md | 4 +- .../iac/guides/migration/import/_index.md | 21 +-- .../from-cloudformation.md | 86 +----------- .../migrating-to-pulumi/from-kubernetes.md | 120 +---------------- .../migrating-to-pulumi/from-terraform.md | 22 +--- 25 files changed, 53 insertions(+), 758 deletions(-) diff --git a/content/docs/iac/automation-api/_index.md b/content/docs/iac/automation-api/_index.md index c099546b5ef7..add24a4e2e4f 100644 --- a/content/docs/iac/automation-api/_index.md +++ b/content/docs/iac/automation-api/_index.md @@ -35,7 +35,7 @@ To learn how to use Automation API, see [Getting Started with Automation API](/d The following examples demonstrate how to use Automation API in various use cases. -{{< chooser language "typescript,javascript,python,go,csharp,java" >}} +{{< chooser language "typescript,python,go,csharp,java" >}} {{% choosable language typescript %}} @@ -48,11 +48,7 @@ The following examples demonstrate how to use Automation API in various use case * [Remote Deployment - ts-node](https://github.com/pulumi/automation-api-examples/blob/main/nodejs/remoteDeployment-tsnode) {{% /choosable %}} -{{% choosable language javascript %}} -* [Inline Program](https://github.com/pulumi/automation-api-examples/blob/main/nodejs/inlineProgram-js) - -{{% /choosable %}} {{% choosable language python %}} * [Inline Program](https://github.com/pulumi/automation-api-examples/blob/main/python/inline_program) diff --git a/content/docs/iac/automation-api/getting-started-automation-api.md b/content/docs/iac/automation-api/getting-started-automation-api.md index 2d11a6813ae8..483786df5b3b 100644 --- a/content/docs/iac/automation-api/getting-started-automation-api.md +++ b/content/docs/iac/automation-api/getting-started-automation-api.md @@ -33,9 +33,9 @@ Install the required language runtime, if you have not already. #### Choose your language -{{< chooser language "javascript,typescript,python,go,csharp,java" >}} +{{< chooser language "typescript,python,go,csharp,java" >}} -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} {{< install-node >}} {{% /choosable %}} @@ -62,11 +62,11 @@ You'll need a [Pulumi access token](/docs/pulumi-cloud/accounts#access-tokens) s ## Define your Pulumi program -{{< chooser language "javascript,typescript,python,go,csharp,java" >}} +{{< chooser language "typescript,python,go,csharp,java" >}} First, define the Pulumi program you want to run as a function within your overall program. Note how it looks like a standard Pulumi program. -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} {{% notes type="info" %}} This tutorial is based on the [`inlineProgram-ts` example](https://github.com/pulumi/automation-api-examples/tree/main/nodejs/inlineProgram-ts), which is a complete example of how to construct a simple Automation API program. @@ -401,9 +401,9 @@ As with executing Pulumi programs through the CLI, you need to associate your Pu Here's a convenient method to select an existing `Stack` or create one if none exists: -{{< chooser language "javascript,typescript,python,go,csharp,java" >}} +{{< chooser language "typescript,python,go,csharp,java" >}} -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} ```typescript const args: InlineProgramArgs = { @@ -469,8 +469,8 @@ A `Stack` object operates within the context of a `Workspace`. A `Workspace` is The AWS plugin also needs configuration. You can provide that configuration just as you would with other Pulumi programs: either through [stack configuration](/docs/concepts/config/) or environment variables. In this tutorial, you'll use the `Stack` object to set the AWS region for the AWS provider plugin. -{{< chooser language "javascript,typescript,python,go,csharp,java" >}} -{{% choosable language "javascript,typescript" %}} +{{< chooser language "typescript,python,go,csharp,java" >}} +{{% choosable language "typescript" %}} ```typescript await stack.workspace.installPlugin("aws", "v4.0.0"); @@ -527,8 +527,8 @@ stack.setConfig("aws:region", new ConfigValue("us-west-2")); You're now ready to execute commands against the `Stack`, including update, preview, refresh, destroy, import, and export. If you want to update the stack, invoke the update method (`up`) against the `Stack` object: -{{< chooser language "javascript,typescript,python,go,csharp,java" >}} -{{% choosable language "javascript,typescript" %}} +{{< chooser language "typescript,python,go,csharp,java" >}} +{{% choosable language "typescript" %}} ```typescript const upRes = await stack.up({ onOutput: console.info }); diff --git a/content/docs/iac/concepts/resources/options/hidediffs.md b/content/docs/iac/concepts/resources/options/hidediffs.md index 27bce2e55a9d..f3014d53caa1 100644 --- a/content/docs/iac/concepts/resources/options/hidediffs.md +++ b/content/docs/iac/concepts/resources/options/hidediffs.md @@ -28,16 +28,8 @@ This is useful when working with properties that generate large or verbose diffs ## Example usage -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" >}} - -{{% choosable language javascript %}} - -```javascript -let res = new MyResource("res", - { prop: "new-value" }, { hideDiffs: ["prop"] }); -``` +{{< chooser language "typescript,python,go,csharp,java,yaml" >}} -{{% /choosable %}} {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/get-started/aws/_index.md b/content/docs/iac/get-started/aws/_index.md index 209ede02b60c..679010f71d8d 100644 --- a/content/docs/iac/get-started/aws/_index.md +++ b/content/docs/iac/get-started/aws/_index.md @@ -27,9 +27,9 @@ Complete this step-by-step tutorial to deploy an AWS S3 bucket-based website usi First, choose your language and ensure you've performed any prerequisites: -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} -{{% choosable language "typescript,javascript" %}} +{{% choosable language "typescript" %}} * An AWS account * Node.js and npm installed locally diff --git a/content/docs/iac/get-started/aws/create-component.md b/content/docs/iac/get-started/aws/create-component.md index 8820429f450f..59bbb6958321 100644 --- a/content/docs/iac/get-started/aws/create-component.md +++ b/content/docs/iac/get-started/aws/create-component.md @@ -22,16 +22,6 @@ complexity and enable sharing and reuse. Instead of copy-pasting common patterns You will now create your first component that packages up your S3 website so you can easily stamp out entire websites in just a few lines of code: -{{% choosable language javascript %}} - -```javascript -const website = new AwsS3Website("my-website", { - files: [ "index.html" ], -}); -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```typescript @@ -104,32 +94,6 @@ component -- the `files` to add to the website -- and outputs -- a single proper To get going, create a new file {{< compfile >}} alongside {{< langfile >}} and add the following: -{{% choosable language javascript %}} - -```javascript -"use strict"; -const aws = require("@pulumi/aws"); -const pulumi = require("@pulumi/pulumi"); - -// A component that encapsulates creating an AWS S3 hosted static website. -export class AwsS3Website extends pulumi.ComponentResource { - constructor(name, args, opts) { - super("quickstart:index:AwsS3Website", name, args, opts); - - // Component initialization will go here next... - - this.registerOutputs({}); // Signal component completion. - } -} - -module.exports = { - AWSS3Website, - AWSS3WebsiteArgs, -}; -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```typescript @@ -296,73 +260,6 @@ Next, make four changes: The resulting {{< compfile >}} file will look like this; feel free to make each edit one at a time if you'd like to get a feel for things, or simply paste the contents of this into {{< compfile >}}: -{{% choosable language javascript %}} - -```javascript -"use strict"; -const pulumi = require("@pulumi/pulumi"); -const aws = require("@pulumi/aws"); - -// A component that encapsulates creating an AWS S3 hosted static website. -class AwsS3Website extends pulumi.ComponentResource { - constructor(name, args, opts) { - super("quickstart:index:AwsS3Website", name, args, opts); - - // Create an AWS resource (S3 Bucket) - const bucket = new aws.s3.Bucket("my-bucket", {}, { - // Set the parent to the component (step #2) above. - // Also, do the same for all other resources below. - parent: this, - }); - - // Turn the bucket into a website: - const website = new aws.s3.BucketWebsiteConfiguration("website", { - bucket: bucket.id, - indexDocument: { - suffix: "index.html", - }, - }, { parent: this }); - - // Permit access control configuration: - const ownershipControls = new aws.s3.BucketOwnershipControls("ownership-controls", { - bucket: bucket.id, - rule: { - objectOwnership: "ObjectWriter" - } - }, { parent: this }); - - // Enable public access to the website: - const publicAccessBlock = new aws.s3.BucketPublicAccessBlock("public-access-block", { - bucket: bucket.id, - blockPublicAcls: false, - }, { parent: this }); - - // Create an S3 Bucket object for each file; note the changes to name/source: - for (const file of args.files) { - new aws.s3.BucketObject(file, { - bucket: bucket.id, - source: new pulumi.asset.FileAsset(file), - contentType: "text/html", - acl: "public-read", - }, { - dependsOn: [ownershipControls, publicAccessBlock], - parent: this, - }); - } - - // Capture the URL and make it available as a component property and output: - this.url = pulumi.interpolate`http://${website.websiteEndpoint}`; - this.registerOutputs({ url: this.url }) // Signal component completion. - } -} - -module.exports = { - AWSS3Website, -}; -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```typescript @@ -786,23 +683,6 @@ Ensure the file is empty and we will build it back up by simply importing and in Add this to your now-empty {{< langfile >}}: -{{% choosable language javascript %}} - -```javascript -"use strict"; -// Import from our new component module: -const web = require("./website"); - -// Create an instance of our component with the same files as before: -const website = new web.AwsS3Website("my-website", { - files: [ "index.html" ], -}); - -exports.url = website.url; -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/get-started/aws/create-project.md b/content/docs/iac/get-started/aws/create-project.md index aeece5fe20fd..d3f692d7a19a 100644 --- a/content/docs/iac/get-started/aws/create-project.md +++ b/content/docs/iac/get-started/aws/create-project.md @@ -59,24 +59,6 @@ $ cd pulumi-start-aws Now initialize a new Pulumi project for AWS using the `pulumi new` command: -{{% choosable language javascript %}} - -{{% choosable os "linux,macos" %}} - -```bash -$ pulumi new aws-javascript -``` - -{{% /choosable %}} -{{% choosable os "windows" %}} - -```powershell -> pulumi new aws-javascript -``` - -{{% /choosable %}} - -{{% /choosable %}} {{% choosable language typescript %}} {{% choosable os "linux,macos" %}} @@ -199,7 +181,7 @@ The AWS region to deploy into (aws:region) (us-east-1): us-west-2 {{< cli-note >}} -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} After some dependency installations from `npm`, the project and stack will be ready. @@ -233,7 +215,7 @@ If you list the contents of your directory, you'll see some key files: {{% /choosable %}} -{{% choosable language "javascript,typescript,python,go,csharp,java" %}} +{{% choosable language "typescript,python,go,csharp,java" %}} - {{< langfile >}} contains your project's main code that declares a new S3 bucket - `Pulumi.yaml` is a [project file](/docs/iac/concepts/projects/project-file) containing metadata about your project like its name @@ -249,23 +231,6 @@ If you list the contents of your directory, you'll see some key files: Now examine the code in {{< langfile >}}: -{{% choosable language javascript %}} - -```javascript -"use strict"; -const pulumi = require("@pulumi/pulumi"); -const aws = require("@pulumi/aws"); -const awsx = require("@pulumi/awsx"); - -// Create an AWS resource (S3 Bucket) -const bucket = new aws.s3.Bucket("my-bucket"); - -// Export the name of the bucket -exports.bucketName = bucket.id; -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/get-started/aws/deploy-stack.md b/content/docs/iac/get-started/aws/deploy-stack.md index 211f03aae529..1d50e39ca9ab 100644 --- a/content/docs/iac/get-started/aws/deploy-stack.md +++ b/content/docs/iac/get-started/aws/deploy-stack.md @@ -89,7 +89,7 @@ the contents of your new bucket -- which of course will be empty: {{% choosable os "linux,macos" %}} -{{% choosable language "javascript,typescript,go,csharp,java,yaml" %}} +{{% choosable language "typescript,go,csharp,java,yaml" %}} ```bash $ aws s3 ls s3://$(pulumi stack output bucketName) @@ -109,7 +109,7 @@ $ aws s3 ls s3://$(pulumi stack output bucket_name) {{% choosable os "windows" %}} -{{% choosable language "javascript,typescript,go,csharp,java,yaml" %}} +{{% choosable language "typescript,go,csharp,java,yaml" %}} ```powershell $ aws s3 ls ("s3://" + (pulumi stack output bucketName)) diff --git a/content/docs/iac/get-started/aws/modify-program.md b/content/docs/iac/get-started/aws/modify-program.md index 99cfc7d89443..3d24782ae415 100644 --- a/content/docs/iac/get-started/aws/modify-program.md +++ b/content/docs/iac/get-started/aws/modify-program.md @@ -37,7 +37,7 @@ To turn your bucket into a static website, start by adding three new AWS S3 reso Open up {{< langfile >}} in your editor and add them right after your S3 bucket: -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} ```typescript // Bucket... @@ -271,7 +271,7 @@ Next, add a new file called `index.html` to your current directory with these co Then open {{< langfile >}} and create a [`BucketObject`](/registry/packages/aws/api-docs/s3/bucketobject/) after the three other new resources: -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} ```typescript // Other resources ... @@ -406,15 +406,6 @@ automatically but these ones are invisible to Pulumi because those specific reso Now to export the website's URL for easy access add this to the end of your program: -{{% choosable language javascript %}} - -```javascript -// Export the bucket's autoassigned URL: -exports.url = pulumi.interpolate`http://${website.websiteEndpoint}`; -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/get-started/azure/review-project.md b/content/docs/iac/get-started/azure/review-project.md index 4e6cf9576e1a..e950259f148a 100644 --- a/content/docs/iac/get-started/azure/review-project.md +++ b/content/docs/iac/get-started/azure/review-project.md @@ -18,7 +18,7 @@ aliases: Let's review some of the generated project files: -{{% choosable language "javascript,typescript,python,go,csharp,java" %}} +{{% choosable language "typescript,python,go,csharp,java" %}} - `Pulumi.yaml` defines the [project](/docs/concepts/projects/). @@ -44,7 +44,7 @@ Let's review some of the generated project files: {{% /choosable %}} -{{% choosable language "javascript,typescript,go,csharp,java" %}} +{{% choosable language "typescript,go,csharp,java" %}} - {{< langfile >}} is the Pulumi program that defines your stack resources. diff --git a/content/docs/iac/get-started/gcp/begin.md b/content/docs/iac/get-started/gcp/begin.md index 6857533f19c9..07046fab58df 100644 --- a/content/docs/iac/get-started/gcp/begin.md +++ b/content/docs/iac/get-started/gcp/begin.md @@ -34,9 +34,9 @@ Next, install the required language runtime, if you have not already. #### Choose Your Language -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} {{< install-node >}} {{% /choosable %}} diff --git a/content/docs/iac/get-started/gcp/create-project.md b/content/docs/iac/get-started/gcp/create-project.md index 3678b56053d3..fcc2e9de46ba 100644 --- a/content/docs/iac/get-started/gcp/create-project.md +++ b/content/docs/iac/get-started/gcp/create-project.md @@ -18,16 +18,8 @@ aliases: Now that you have set up your environment by installing Pulumi, installing your preferred language runtime, and configuring your Google Cloud credentials, let's create your first Pulumi program. -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} -{{% choosable language javascript %}} - -```bash -$ mkdir quickstart && cd quickstart -$ pulumi new gcp-javascript -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```bash @@ -116,7 +108,7 @@ Saved config > What are [projects](/docs/concepts/projects/) and [stacks](/docs/concepts/stack/)? Pulumi projects and stacks let you organize Pulumi code. Consider a Pulumi _project_ to be analogous to a GitHub repo---a single place for code---and a _stack_ to be an instance of that code with a separate configuration. For instance, _Project Foo_ may have multiple stacks for different development environments (Dev, Test, or Prod), or perhaps for different cloud configurations (geographic region for example). See [Organizing Projects and Stacks](/docs/using-pulumi/organizing-projects-stacks/) for some best practices on organizing your Pulumi projects and stacks. -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} After some dependency installations from `npm`, the project and stack will be ready. diff --git a/content/docs/iac/get-started/gcp/deploy-changes.md b/content/docs/iac/get-started/gcp/deploy-changes.md index 001a702d644e..220b5425a445 100644 --- a/content/docs/iac/get-started/gcp/deploy-changes.md +++ b/content/docs/iac/get-started/gcp/deploy-changes.md @@ -64,15 +64,7 @@ Duration: 8s Once the update has completed, you can verify the object was created by checking the Google Cloud Console or running the following `gsutil` command: -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" >}} - -{{% choosable language javascript %}} - -```bash -$ gsutil ls $(pulumi stack output bucketName) -``` - -{{% /choosable %}} +{{< chooser language "typescript,python,go,csharp,java,yaml" >}} {{% choosable language typescript %}} @@ -130,30 +122,6 @@ Notice that your `index.html` file has been added to the bucket: gs://my-bucket-daa12be/index.html-a52debd ``` -{{% choosable language javascript %}} - -Now that `index.html` exists in the bucket, modify the program to have the bucket serve the file as a static website. - -To do that, update the bucket definition to configure its `website` property. Then, to align with Google Cloud Storage recommendations, set its uniform bucket-level access property to `true`: - -```javascript -const bucket = new gcp.storage.Bucket("my-bucket", { - location: "US", - website: { - mainPageSuffix: "index.html" - }, - uniformBucketLevelAccess: true -}); -``` - -Finally, at the end of the file, export the website's public URL to make it easy to access: - -```javascript -exports.bucketEndpoint = pulumi.concat("http://storage.googleapis.com/", bucket.name, "/", bucketObject.name); -``` - -{{% /choosable %}} - {{% choosable language typescript %}} Now that `index.html` exists in the bucket, modify the program to have the bucket serve the file as a static website. @@ -388,14 +356,6 @@ Duration: 4s When the deployment completes, you can check out your new static website at the URL under `Outputs`, or make a `curl` request and see the contents of `index.html` printed to the terminal: -{{% choosable language javascript %}} - -```bash -$ curl $(pulumi stack output bucketEndpoint) -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```bash diff --git a/content/docs/iac/get-started/gcp/deploy-stack.md b/content/docs/iac/get-started/gcp/deploy-stack.md index 2e1731b65daa..f9279a9f6446 100644 --- a/content/docs/iac/get-started/gcp/deploy-stack.md +++ b/content/docs/iac/get-started/gcp/deploy-stack.md @@ -63,15 +63,7 @@ Duration: 4s Remember the output you defined in the previous step? That [stack output](/docs/concepts/stack#outputs) can be seen in the `Outputs:` section of your update. You can access your outputs from the CLI by running the `pulumi stack output [property-name]` command. For example you can print the name of your bucket with the following command: -{{< chooser language "typescript,javascript,python,go,csharp,java,yaml" / >}} - -{{% choosable language javascript %}} - -```bash -$ pulumi stack output bucketName -``` - -{{% /choosable %}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} {{% choosable language typescript %}} diff --git a/content/docs/iac/get-started/gcp/modify-program.md b/content/docs/iac/get-started/gcp/modify-program.md index 0967c0c08b30..d4df8165d842 100644 --- a/content/docs/iac/get-started/gcp/modify-program.md +++ b/content/docs/iac/get-started/gcp/modify-program.md @@ -66,20 +66,7 @@ Now that you have an `index.html` file with some content, open {{< langfile >}} For this, you'll use Pulumi's `FileAsset` class to assign the content of the file to a new `BucketObject`. -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} - -{{% choosable language javascript %}} - -In `index.js`, create the `BucketObject` right after creating the bucket itself: - -```javascript -const bucketObject = new gcp.storage.BucketObject("index.html", { - bucket: bucket.name, - source: new pulumi.asset.FileAsset("index.html") -}); -``` - -{{% /choosable %}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} {{% choosable language typescript %}} @@ -201,18 +188,6 @@ const bucketBinding = new gcp.storage.BucketIAMBinding("my-bucket-binding", { {{% /choosable %}} -{{% choosable language javascript %}} - -```javascript -const bucketBinding = new gcp.storage.BucketIAMBinding("my-bucket-binding", { - bucket: bucket.name, - role: "roles/storage.objectViewer", - members: ["allUsers"] -}); -``` - -{{% /choosable %}} - {{% choosable language python %}} ```python diff --git a/content/docs/iac/get-started/gcp/review-project.md b/content/docs/iac/get-started/gcp/review-project.md index d95bd1107745..49792433dd3a 100644 --- a/content/docs/iac/get-started/gcp/review-project.md +++ b/content/docs/iac/get-started/gcp/review-project.md @@ -18,7 +18,7 @@ aliases: Let's review some of the generated project files: -{{% choosable language "javascript,typescript,python,go,csharp,java" %}} +{{% choosable language "typescript,python,go,csharp,java" %}} - `Pulumi.yaml` defines the [project](/docs/concepts/projects/). @@ -44,7 +44,7 @@ Let's review some of the generated project files: {{% /choosable %}} -{{% choosable language "javascript,typescript,go,csharp,java" %}} +{{% choosable language "typescript,go,csharp,java" %}} - {{< langfile >}} is the Pulumi program that defines your stack resources. @@ -52,25 +52,7 @@ Let's review some of the generated project files: Let's examine {{< langfile >}}. -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} - -{{% choosable language javascript %}} - -```javascript -"use strict"; -const pulumi = require("@pulumi/pulumi"); -const gcp = require("@pulumi/gcp"); - -// Create a Google Cloud resource (Storage Bucket) -const bucket = new gcp.storage.Bucket("my-bucket", { - location: "US" -}); - -// Export the DNS name of the bucket -exports.bucketName = bucket.url; -``` - -{{% /choosable %}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} {{% choosable language typescript %}} @@ -208,14 +190,6 @@ outputs: This Pulumi program creates a new storage bucket and exports the DNS name of the bucket. -{{% choosable language javascript %}} - -```javascript -exports.bucketName = bucket.url; -``` - -{{% /choosable %}} - {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/get-started/kubernetes/begin.md b/content/docs/iac/get-started/kubernetes/begin.md index 10c7e8a03996..4bb642b595f7 100644 --- a/content/docs/iac/get-started/kubernetes/begin.md +++ b/content/docs/iac/get-started/kubernetes/begin.md @@ -35,9 +35,9 @@ Next, we'll install the required language runtime. #### Choose Your Language -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} {{< install-node >}} {{% /choosable %}} diff --git a/content/docs/iac/get-started/kubernetes/create-project.md b/content/docs/iac/get-started/kubernetes/create-project.md index a416b22fa265..a10a8f541c45 100644 --- a/content/docs/iac/get-started/kubernetes/create-project.md +++ b/content/docs/iac/get-started/kubernetes/create-project.md @@ -16,16 +16,8 @@ aliases: --- Now that you have set up your environment let's create your first Pulumi program. -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} -{{% choosable language javascript %}} - -```bash -$ mkdir quickstart && cd quickstart -$ pulumi new kubernetes-javascript -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```bash @@ -105,7 +97,7 @@ Created stack 'dev' > What are [projects](/docs/concepts/projects/) and [stacks](/docs/concepts/stack/)? Pulumi projects and stacks let you organize Pulumi code. Consider a Pulumi _project_ to be analogous to a GitHub repo---a single place for code---and a _stack_ to be an instance of that code with a separate configuration. For instance, _Project Foo_ may have multiple stacks for different development environments (Dev, Test, or Prod), or perhaps for different cloud configurations (geographic region for example). See [Organizing Projects and Stacks](/docs/using-pulumi/organizing-projects-stacks/) for some best practices on organizing your Pulumi projects and stacks. -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} After some dependency installations from `npm`, the project and stack will be ready. diff --git a/content/docs/iac/get-started/kubernetes/modify-program.md b/content/docs/iac/get-started/kubernetes/modify-program.md index 7756b07ced4d..3e2b5a2955fd 100644 --- a/content/docs/iac/get-started/kubernetes/modify-program.md +++ b/content/docs/iac/get-started/kubernetes/modify-program.md @@ -19,52 +19,8 @@ Now that we have an instance of our Pulumi program deployed, let's update it to Replace the entire contents of {{< langfile >}} with the following: -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} -{{% choosable language javascript %}} - -```javascript -"use strict"; -const pulumi = require("@pulumi/pulumi"); -const k8s = require("@pulumi/kubernetes"); - -// Minikube does not implement services of type `LoadBalancer`; require the user to specify if we're -// running on minikube, and if so, create only services of type ClusterIP. -const config = new pulumi.Config(); -const isMinikube = config.requireBoolean("isMinikube"); - -const appName = "nginx"; -const appLabels = { app: appName }; -const deployment = new k8s.apps.v1.Deployment(appName, { - spec: { - selector: { matchLabels: appLabels }, - replicas: 1, - template: { - metadata: { labels: appLabels }, - spec: { containers: [{ name: appName, image: "nginx" }] } - } - } -}); - -// Allocate an IP to the Deployment. -const frontend = new k8s.core.v1.Service(appName, { - metadata: { labels: deployment.spec.template.metadata.labels }, - spec: { - type: isMinikube ? "ClusterIP" : "LoadBalancer", - ports: [{ port: 80, targetPort: 80, protocol: "TCP" }], - selector: appLabels - } -}); - -// When "done", this will print the public IP. -exports.ip = isMinikube - ? frontend.spec.clusterIP - : frontend.status.loadBalancer.apply( - (lb) => lb.ingress[0].ip || lb.ingress[0].hostname - ); -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/get-started/kubernetes/review-project.md b/content/docs/iac/get-started/kubernetes/review-project.md index d1da91be5227..60e73ad5cd54 100644 --- a/content/docs/iac/get-started/kubernetes/review-project.md +++ b/content/docs/iac/get-started/kubernetes/review-project.md @@ -17,7 +17,7 @@ aliases: Let's review some of the generated project files: -{{% choosable language "javascript,typescript,python,go,csharp,java" %}} +{{% choosable language "typescript,python,go,csharp,java" %}} - `Pulumi.yaml` defines the [project](/docs/concepts/projects/). @@ -43,7 +43,7 @@ Let's review some of the generated project files: {{% /choosable %}} -{{% choosable language "javascript,typescript,go,csharp,java" %}} +{{% choosable language "typescript,go,csharp,java" %}} - {{< langfile >}} is the Pulumi program that defines your stack resources. @@ -51,29 +51,8 @@ Let's review some of the generated project files: Let's examine {{< langfile >}}. -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" / >}} +{{< chooser language "typescript,python,go,csharp,java,yaml" / >}} -{{% choosable language javascript %}} - -```javascript -"use strict"; -const k8s = require("@pulumi/kubernetes"); - -const appLabels = { app: "nginx" }; -const deployment = new k8s.apps.v1.Deployment("nginx", { - spec: { - selector: { matchLabels: appLabels }, - replicas: 1, - template: { - metadata: { labels: appLabels }, - spec: { containers: [{ name: "nginx", image: "nginx" }] } - } - } -}); -exports.name = deployment.metadata.name; -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/guides/building-extending/components/build-a-component.md b/content/docs/iac/guides/building-extending/components/build-a-component.md index b973824b3ef6..40e59ddccb0e 100644 --- a/content/docs/iac/guides/building-extending/components/build-a-component.md +++ b/content/docs/iac/guides/building-extending/components/build-a-component.md @@ -97,33 +97,6 @@ The `PulumiPlugin.yaml` file tells Pulumi that this directory is a component, ra {{< chooser language "typescript,python,go,csharp,java,yaml" >}} -{{% choosable language javascript %}} - -{{% notes type="info" %}} -Authoring sharable components in JavaScript is not currently supported. Considering writing in TypeScript instead! -{{% /notes %}} - -{{% /choosable %}} - -{{% choosable language yaml %}} - -***Example:** `PulumiPlugin.yaml` for YAML* - -```yaml -runtime: yaml -``` - -Because we're also authoring the component in YAML, the `PulumiPlugin.yaml` file will be used to define all aspects of the the component. In most other languages, a package/project configuration file would name the component module. In YAML, all you need to do is set the `name` property: - -```yaml {hl_lines=[2]} -runtime: yaml -name: static-page-component -``` - -This name will be important later on in the component implementation, so make sure it's something unique and descriptive! - -{{% /choosable %}} - {{% choosable language typescript %}} ***Example:** `PulumiPlugin.yaml` for TypeScript* @@ -382,12 +355,6 @@ The `com.pulumi.pulumi` SDK contains everything we need for making a component. {{< chooser language "typescript,python,go,csharp,java,yaml" >}} -{{% choosable language javascript %}} - -Authoring sharable components in JavaScript is not currently supported. Considering writing in TypeScript instead! - -{{% /choosable %}} - {{% choosable language typescript %}} First, create the `index.ts` file, where we will export the component class. @@ -530,9 +497,6 @@ Components typically require two parts: a subclass of `pulumi.ComponentResource` {{< chooser language "typescript,python,go,csharp,java,yaml" >}} -{{% choosable language javascript %}} -{{% /choosable %}} - {{% choosable language typescript %}} First create a file called `staticpage.ts`, and add the imports we will need: @@ -651,9 +615,6 @@ Next, we will implement the arguments class. In our example here, we will pass t {{< chooser language "typescript,python,go,csharp,java,yaml" >}} -{{% choosable language javascript %}} -{{% /choosable %}} - {{% choosable language typescript %}} ***Example:** `staticpage.ts` the Component arguments implementation* @@ -769,13 +730,6 @@ Inputs can be any basic type (e.g. `boolean`, `integer`, `string`) or an `array` {{< chooser language "typescript,python,go,csharp,java,yaml" >}} -{{% choosable language javascript %}} - -Authoring sharable components in JavaScript is not currently supported. -Considering writing in TypeScript instead! - -{{% /choosable %}} - {{% choosable language typescript %}} Now we can implement the component itself. Components should inherit from `pulumi.ComponentResource`, and should accept the required arguments class we just defined in the constructor. All the work for our component happens in the constructor, and outputs are returned via class properties. At the end of the process a calling `self.registerOutputs` signals Pulumi that the process of creating the component resource has completed. @@ -1298,9 +1252,6 @@ Let's dissect this component implementation piece-by-piece: {{< chooser language "typescript,python,go,csharp,java,yaml" >}} -{{% choosable language javascript %}} -{{% /choosable %}} - {{% choosable language typescript %}} #### Inheriting from the base class @@ -2334,78 +2285,7 @@ $ cd .. $ mkdir use-static-page-component ``` -{{< chooser language "javascript,typescript,python,go,csharp,java,yaml" >}} - -{{% choosable language javascript %}} - -***Example:** A `Pulumi.yaml` file for a Pulumi project written in JavaScript* - -```yaml -name: use-static-page-component -description: A minimal JavaScript Pulumi program that uses the custom Static Page component -runtime: - name: nodejs - options: - typescript: false -``` - -#### Generate the SDK - -In order to use our Pulumi component from source, we'll need to generate a Javascript-specific SDK to use in a Pulumi program. From the root directory of your `use-static-page-component` Pulumi project, run the following command: - -```bash -pulumi package add ../static-page-component -``` - -This creates a new subdirectory called `sdks/` that contains the generated SDK. - -#### Add the NodeJS project file - -Now lets create our `package.json`. We'll need the standard `pulumi` SDK and our custom component. To use that, just add the path to the generated JavaScript SDK using the format `file:` instead of a package version spec. - -***Example:** `package.json`* - -```json -{ - "name": "use-static-page-component", - "dependencies": { - "@pulumi/pulumi": "^3.191.0", - "@pulumi/static-page-component": "file:sdks/static-page-component" - } -} -``` - -Note that we don't need to add the Pulumi AWS provider library here, because that dependency is handled by the component project, in whatever langauge you implemented it in. We just need to carry a reference to the component SDK which provides us access to the component via RPC to its provider host. This creates a clean separation of concerns between the component implementation and the end users of the component. - -#### Install dependencies - -Next, install the `pulumi` dependencies: - -```bash -pulumi install -``` - -#### Create the Pulumi program - -***Example:** `index.js` that uses the Static Page component* - -```javascript -"use strict"; - -const pulumi = require("@pulumi/pulumi"); -const staticpagecomponent = require("@pulumi/static-page-component"); - -const pageHTML = "

I love Pulumi!

"; - -const page = new staticpagecomponent.StaticPage("my-static-page", { - indexContent: pageHTML -}) - -// Export the URL to the index page -exports.websiteURL = pulumi.interpolate `http://${page.endpoint}`; -``` - -{{% /choosable %}} +{{< chooser language "typescript,python,go,csharp,java,yaml" >}} {{% choosable language typescript %}} diff --git a/content/docs/iac/guides/building-extending/packages/schema.md b/content/docs/iac/guides/building-extending/packages/schema.md index 0e011b610c1e..af1f0177b7cb 100644 --- a/content/docs/iac/guides/building-extending/packages/schema.md +++ b/content/docs/iac/guides/building-extending/packages/schema.md @@ -280,9 +280,9 @@ Several schema types contain a `language` field which is a map from a supported Language-specific information for a package. -{{% chooser language "javascript,typescript,python,go,csharp,java" / %}} +{{% chooser language "typescript,python,go,csharp,java" / %}} -{{% choosable language "javascript,typescript" %}} +{{% choosable language "typescript" %}} For `javascript, typescript`: diff --git a/content/docs/iac/guides/migration/import/_index.md b/content/docs/iac/guides/migration/import/_index.md index 8b9f8580a41b..4aa428ee394d 100644 --- a/content/docs/iac/guides/migration/import/_index.md +++ b/content/docs/iac/guides/migration/import/_index.md @@ -504,27 +504,8 @@ Code-based import also differs from the CLI-based approach in that it doesn't im The following example imports an existing AWS EC2 security group with an assigned cloud provider ID of `sg-04aeda9a214730248`: -{{< chooser language "javascript,typescript,python,go,csharp" >}} +{{< chooser language "typescript,python,go,csharp" >}} -{{% choosable language javascript %}} - -```javascript -const aws = require("@pulumi/aws"); - -const group = new aws.ec2.SecurityGroup("my-sg", { - name: "my-sg-62a569b", - ingress: [{ - protocol: "tcp", - fromPort: 80, - toPort: 80, - cidrBlocks: ["0.0.0.0/0"] - }], -}, { - import: "sg-04aeda9a214730248" -}); -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/guides/migration/migrating-to-pulumi/from-cloudformation.md b/content/docs/iac/guides/migration/migrating-to-pulumi/from-cloudformation.md index b4588aedc541..19bf4d8bfded 100644 --- a/content/docs/iac/guides/migration/migrating-to-pulumi/from-cloudformation.md +++ b/content/docs/iac/guides/migration/migrating-to-pulumi/from-cloudformation.md @@ -32,27 +32,8 @@ For instance, let's say your infrastructure team has provisioned your network in Instead, you can look up that stack by name and use one of its output values. The following example reads an AWS CloudFormation stack named `my-network-stack` and then uses the exported `SubnetId` value to provision a brand new EC2 instance that runs in that subnet: -{{< chooser language "javascript,typescript,python,go,csharp" >}} +{{< chooser language "typescript,python,go,csharp" >}} -{{% choosable language javascript %}} - -```javascript -let aws = require("@pulumi/aws"); - -let network = aws.cloudformation.getStackOutput({ - name: "my-network-stack", -}); - -let subnetId = network.outputs["SubnetId"]; - -let web = new aws.ec2.Instance("web", { - ami: "ami-0adc0e3ef2558cb1f", // us-west-2 AMI - instanceType: "t3.micro", - subnetId: subnetId, -}); -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```typescript @@ -185,53 +166,8 @@ The Pulumi AWS package [provides a CloudFormation Stack](/registry/packages/aws/ For instance, this code deploys a simple CloudFormation template using the given parameters, and exports the resulting VPC ID: -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -let aws = require("@pulumi/aws"); +{{< chooser language "typescript,python,go,csharp" >}} -let template = `{ - "Parameters" : { - "VPCCidr" : { - "Type" : "String", - "Default" : "10.0.0.0/16", - "Description" : "Enter the CIDR block for the VPC. Default is 10.0.0.0/16." - } - }, - "Resources": { - "myVpc": { - "Type" : "AWS::EC2::VPC", - "Properties" : { - "CidrBlock" : { "Ref" : "VPCCidr" }, - "Tags" : [ - {"Key": "Name", "Value": "Primary_CF_VPC"} - ] - } - } - }, - "Outputs": { - "VpcId": { - "Value": { "Ref": "myVpc" } - } - } -} -`; - -let network = new aws.cloudformation.Stack("network", { - templateBody: template, - parameters: { - VPCCidr: "10.0.0.0/16", - }, -}); - -module.exports = { - vpcId: network.outputs["VpcId"], -}; -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```typescript @@ -503,24 +439,8 @@ Remember to run `pulumi up` so that your changes are applied before moving on. Next, we can adopt the resources under Pulumi's control, by using `import` IDs. For this example, recall that our VPC ID from above was `"vpc-0e1a74859af1da17f"`, which is what we will use for illustration purposes. Also, in this example, there is just one resource, so we can simply delete the CloudFormation stack in its entirety and replace it with a Pulumi definition of the VPC. In cases where multiple resources exist, you can delete them one by one, until the stack is eventually empty. -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -let aws = require("@pulumi/aws"); +{{< chooser language "typescript,python,go,csharp" >}} -let vpc = new aws.ec2.Vpc("myVpc", { - cidrBlock: "10.0.0.0/16", - tags: { Name: "Primary_CF_VPC" }, -}, { import: "vpc-0e1a74859af1da17f" }); - -module.exports = { - vpcId: vpc.id, -}; -``` - -{{% /choosable %}} {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/guides/migration/migrating-to-pulumi/from-kubernetes.md b/content/docs/iac/guides/migration/migrating-to-pulumi/from-kubernetes.md index 11f55997e7eb..2572c152326a 100644 --- a/content/docs/iac/guides/migration/migrating-to-pulumi/from-kubernetes.md +++ b/content/docs/iac/guides/migration/migrating-to-pulumi/from-kubernetes.md @@ -45,26 +45,8 @@ $ curl -L --remote-name \ This Pulumi program uses `ConfigFile` to read that YAML file, provision the resources inside it, and export the resulting IP addresses: -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -let k8s = require("@pulumi/kubernetes"); - -// Create resources from standard Kubernetes guestbook YAML example. -let guestbook = new k8s.yaml.ConfigFile("guestbook", { - file: "guestbook-all-in-one.yaml", -}); - -// Export the private cluster IP address of the frontend. -let frontend = guestbook.getResource("v1/Service", "frontend"); -module.exports = { - privateIp = frontend.spec.clusterIP, -}; -``` +{{< chooser language "typescript,python,go,csharp" >}} -{{% /choosable %}} {{% choosable language typescript %}} ```typescript @@ -205,27 +187,8 @@ $ popd This Pulumi program uses `ConfigGroup` to read these YAML files, provision the resources inside of them, and export the resulting IP addresses: -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -let k8s = require("@pulumi/kubernetes"); -let path = require("path"); - -// Create resources from standard Kubernetes guestbook YAML example. -let guestbook = new k8s.yaml.ConfigGroup("guestbook", { - files: [ path.join("yaml", "*.yaml") ], -}); - -// Export the private cluster IP address of the frontend. -let frontend = guestbook.getResource("v1/Service", "frontend"); -module.exports = { - privateIp = frontend.spec.clusterIP, -}; -``` +{{< chooser language "typescript,python,go,csharp" >}} -{{% /choosable %}} {{% choosable language typescript %}} ```typescript @@ -392,29 +355,8 @@ In addition to those core options, you can specify `transformations` (similar to To illustrate provisioning a Helm Chart using Pulumi, we will deploy the `wordpress` chart from `https://charts.bitnami.com/bitnami`. This will stand up a fully functional WordPress instance that uses MariaDB: -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -let k8s = require("@pulumi/kubernetes"); - -// Deploy the latest version of the bitnami/wordpress chart. -let wordpress = new k8s.helm.v3.Chart("wpdev", { - fetchOpts: { - repo: "https://charts.bitnami.com/bitnami" - }, - chart: "wordpress", -}); - -// Export the public IP for WordPress. -let frontend = wordpress.getResource("v1/Service", "default/wpdev-wordpress"); -module.exports = { - frontendIp: frontend.status.loadBalancer.ingress[0].ip, -}; -``` +{{< chooser language "typescript,python,go,csharp" >}} -{{% /choosable %}} {{% choosable language typescript %}} ```typescript @@ -772,40 +714,8 @@ To render YAML during a `pulumi up` rather than have Pulumi perform the deployme This example provisions a simple load-balanced NGINX service using a general purpose language but renders the output to YAML: -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -let k8s = require("@pulumi/kubernetes"); - -// Instantiate a Kubernetes Provider and specify the render directory. -let renderProvider = new k8s.Provider("k8s-yaml-renderer", { - renderYamlToDirectory: "yaml", -}); - -// Create an NGINX Deployment and load-balanced Service that use it. -let labels = { "app": "nginx" }; -let dep = new k8s.apps.v1.Deployment("nginx-dep", { - spec: { - selector: { matchLabels: labels }, - replicas: 1, - template: { - metadata: { labels: labels }, - spec: { containers: [{ name: "nginx", image: "nginx" }] }, - }, - }, -}, { provider: renderProvider }); -let svc = new k8s.core.v1.Service("nginx-svc", { - spec: { - type: "LoadBalancer", - selector: labels, - ports: [{ port: 80 }], - }, -}, { provider: renderProvider }); -``` +{{< chooser language "typescript,python,go,csharp" >}} -{{% /choosable %}} {{% choosable language typescript %}} ```typescript @@ -1059,28 +969,8 @@ Let's see how to assign our service a public IP address, starting with [the sing The Kubernetes Guestbook by default does not assign a load balancer for the frontend service. To fix this, we could edit the YAML file, of course, but let's see `transformations` in action. By supplying the `transformations` callback that rewrites the object configuration on the fly, we can cause a load balancer to get created: -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -... -let guestbook = new k8s.yaml.ConfigFile("guestbook", { - file: "guestbook-all-in-one.yaml", - transformations: [(obj: any) => { - if (obj.kind === "Service" && obj.metadata.name === "frontend") { - obj.spec.type = "LoadBalancer"; - } - }], -}); -... -module.exports = { - privateIp = frontend.spec.clusterIP, - publicIp = frontend.status.loadBalancer.ingress[0].ip, -}; -``` +{{< chooser language "typescript,python,go,csharp" >}} -{{% /choosable %}} {{% choosable language typescript %}} ```typescript diff --git a/content/docs/iac/guides/migration/migrating-to-pulumi/from-terraform.md b/content/docs/iac/guides/migration/migrating-to-pulumi/from-terraform.md index 60b07f3d0fe1..4ccebde564da 100644 --- a/content/docs/iac/guides/migration/migrating-to-pulumi/from-terraform.md +++ b/content/docs/iac/guides/migration/migrating-to-pulumi/from-terraform.md @@ -356,28 +356,8 @@ pulumi package add terraform-module terraform-aws-modules/vpc/aws 5.19.0 vpc This will generate a local SDK in your programming language that you can import into your Pulumi program. You can then use this module like any other Pulumi package: -{{< chooser language "javascript,typescript,python,go,csharp" >}} - -{{% choosable language javascript %}} - -```javascript -const vpc = require("@pulumi/vpc"); - -// Create a VPC using the terraform-aws-modules/vpc module -const myVpc = new vpc.Module("my-vpc", { - name: "pulumi-vpc", - cidr: "10.0.0.0/16", - azs: ["us-west-2a", "us-west-2b", "us-west-2c"], - private_subnets: ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"], - public_subnets: ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"], - enable_nat_gateway: true -}); - -// Access outputs from the module -exports.vpcId = myVpc.vpc_id; -``` +{{< chooser language "typescript,python,go,csharp" >}} -{{% /choosable %}} {{% choosable language typescript %}} ```typescript