### Start All-in-One Pulumi Cloud Deployment Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/admin/self-hosted/deployment-options/quickstart-docker-compose Illustrates how to start all Pulumi Cloud components, including a database container, using the all-in-one Docker Compose file. This command leverages working defaults for a quick setup. ```Shell run-ee.sh -f ./all-in-one/docker-compose.yml ``` -------------------------------- ### Example of Interactive Pulumi ESC CLI Login Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/esc/get-started/begin Demonstrates the interactive prompts and successful output when logging into the Pulumi ESC CLI, showing options for browser-based login or access token input. ```shell $ esc login Manage your Pulumi ESC environments by logging in. Run `esc --help` for alternative login options. Enter your access token from https://app.pulumi.com/account/tokens or hit to log in using your browser : Logged in to https://api.pulumi.com/ as your-pulumi-org (https://app.pulumi.com/your-pulumi-org) ``` -------------------------------- ### Example Curl Request to Get Deployment Settings Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/deployments An example `curl` command demonstrating how to make a GET request to retrieve deployment settings for a stack, including necessary headers and authentication. ```curl curl -XGET -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ --location "https://api.pulumi.com/api/stacks/my-org/aws-ts-s3-folder/dev/deployments/settings" ``` -------------------------------- ### Quickstart Installation of Pulumi Kubernetes Operator with kubectl Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/continuous-delivery/pulumi-kubernetes-operator This `kubectl` command performs a simple, non-production quickstart installation of the Pulumi Kubernetes Operator. It applies a manifest directly from the GitHub repository, which also creates a convenient `default/pulumi` Kubernetes service account. ```Shell kubectl apply -f https://raw.githubusercontent.com/pulumi/pulumi-kubernetes-operator/refs/tags/v2.0.0/deploy/quickstart/install.yaml ``` -------------------------------- ### Verify Pulumi CLI Installation Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api These commands check the installed version of the Pulumi CLI across different operating systems. They confirm that Pulumi is successfully installed and accessible in the system's PATH. ```bash $ pulumi version v3.177.0 ``` ```powershell > pulumi version v3.177.0 ``` -------------------------------- ### Deploy S3 Static Website with Pulumi in Java Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api This Java code provides an example of deploying a static website to AWS S3 using Pulumi. It includes steps for creating the S3 bucket, configuring website properties, setting up ownership controls and public access, and uploading the `index.html` content. ```Java private static void pulumiProgram(Context ctx) { // Create an AWS resource (S3 Bucket) var siteBucket = new BucketV2("s3-website-bucket"); var website = new BucketWebsiteConfigurationV2("website", BucketWebsiteConfigurationV2Args.builder() .bucket(siteBucket.id()) .indexDocument(BucketWebsiteConfigurationV2IndexDocumentArgs.builder() .suffix("index.html") .build()) .build()); var ownershipControls = new BucketOwnershipControls("ownershipControls", BucketOwnershipControlsArgs.builder() .bucket(siteBucket.id()) .rule(BucketOwnershipControlsRuleArgs.builder() .objectOwnership("ObjectWriter") .build()) .build()); var publicAccessBlock = new BucketPublicAccessBlock("publicAccessBlock", BucketPublicAccessBlockArgs.builder() .bucket(siteBucket.id()) .blockPublicAcls(false) .build()); String indexContent = """ Hello S3

Hello, world!

Made with ❤️ with Pulumi

"""; var indexHtml = new BucketObject("index.html", BucketObjectArgs.builder() .bucket(siteBucket.id()) .content(indexContent) .contentType("text/html") .acl("public-read") .build(), ``` -------------------------------- ### Install Pulumi CLI on macOS and Linux Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api These commands provide different methods for installing the Pulumi Command Line Interface (CLI) on macOS and Linux systems. Users can choose between Homebrew for package management or a direct installation via a cURL script. ```bash $ brew install pulumi/tap/pulumi ``` ```bash $ curl -fsSL https://get.pulumi.com | sh ``` -------------------------------- ### Install Pulumi CLI on Windows Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api This command installs the Pulumi Command Line Interface (CLI) on Windows systems using the Chocolatey package manager. It simplifies the installation process for Windows users. ```powershell > choco install pulumi ``` -------------------------------- ### Configure Pulumi Provider Plugins Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api Illustrates how to install necessary provider plugins (e.g., AWS) and set configuration values (e.g., AWS region) for the stack using the Automation API across various languages. ```TypeScript await stack.workspace.installPlugin("aws", "v4.0.0"); await stack.setConfig("aws:region", { value: "us-west-2" }); ``` ```Python stack.workspace.install_plugin("aws", "v4.0.0") stack.set_config("aws:region", auto.ConfigValue(value="us-west-2")) ``` ```Go err = w.InstallPlugin(ctx, "aws", "v4.0.0") if err != nil { fmt.Printf("Failed to install program plugins: %v\n", err) os.Exit(1) } s.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: "us-west-2"}) ``` ```C# await stack.Workspace.InstallPluginAsync("aws", "v4.0.0"); await stack.SetConfigAsync("aws:region", new ConfigValue("us-west-2")); ``` ```Java stack.getWorkspace().installPlugin("aws", "v5.41.0"); stack.setConfig("aws:region", new ConfigValue("us-west-2")); ``` -------------------------------- ### Example JSON Response for Get Deployment Settings Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/deployments A sample JSON response body returned when successfully retrieving deployment settings, showing `sourceContext` and `operationContext` details. ```json { "sourceContext": { "git": { "repoURL": "https://github.com/pulumi/deploy-demos.git", "branch": "refs/heads/demo", "repoDir": "pulumi-programs/aws-ts-s3" } }, "operationContext": { "preRunCommands": [ "echo \"hello world\"" ], "environmentVariables": { "AWS_REGION": "us-west-2", "AWS_ACCESS_KEY_ID": "$AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY": "$AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN": "$AWS_SESSION_TOKEN" } } } ``` -------------------------------- ### Example Curl Request to List Pulumi Stack Deployments Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/deployments A curl command example demonstrating how to make a GET request to the Pulumi API to list stack deployments, including authentication and query parameters. ```bash curl -XGET -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ --location "https://api.pulumi.com/api/stacks/my-org/aws-ts-s3-folder/dev/deployments?page=1&pageSize=5" ``` -------------------------------- ### Pulumi project creation prompts Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/azure/create-project Illustrates the interactive prompts for setting the project name and description when creating a new Pulumi project using `pulumi new`. ```shell This command will walk you through creating a new Pulumi project. Enter a value or leave blank to accept the (default), and press . Press ^C at any time to quit. project name: (quickstart) project description: (A minimal Azure Native Pulumi program) Created project 'quickstart' ``` -------------------------------- ### Manually Create and Install Dependencies for Python Policy Pack Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/crossguard/faq These commands show how to manually create a Python virtual environment and install dependencies from `requirements.txt`. This is useful when opting out of Pulumi's automatic virtual environment management or for initial setup. Includes commands for both Unix-like (Linux/macOS) and Windows systems. ```Bash python3 -m venv venv venv/bin/pip install -r requirements.txt ``` ```PowerShell > python -m venv venv > venv\Scripts\pip install -r requirements.txt ``` -------------------------------- ### Verify Pulumi CLI Installation Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/gcp/begin These commands verify the successful installation of the Pulumi CLI by displaying its version number. Running this check confirms that the 'pulumi' executable is correctly configured in your system's PATH environment variable across different operating systems. ```bash $ pulumi version v3.177.0 ``` ```powershell > pulumi version v3.177.0 ``` -------------------------------- ### Example cURL Request: Analyze Pulumi Update Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/copilot Demonstrates how to make a cURL request to the Pulumi Copilot API to analyze a specific Pulumi update and get resolution advice for issues. ```curl curl -L https://api.pulumi.com/api/ai/chat/preview \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "query": "Analyze this update. If it failed, tell me how to resolve the issues.", "state": { "client": { "cloudContext": { "orgId": "myorg", "url": "https://app.pulumi.com/myorg/project1/dev/updates/4" } } } }' ``` -------------------------------- ### Create a New Pulumi Project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/esc/get-started/integrate-with-pulumi-iac Demonstrates how to initialize a new Pulumi project using the `pulumi new` command, including setting project name, description, and stack name. It also shows the dependency installation process for a Python project. ```bash $ pulumi new python This command will walk you through creating a new Pulumi project. Enter a value or leave blank to accept the (default), and press . Press ^C at any time to quit. project name (pulumi-esc-iac): project description (A minimal Python Pulumi program): Created project 'pulumi-esc-iac' Please enter your desired stack name. To create a stack in an organization, use the format / (e.g. `acmecorp/dev`). stack name (dev): pulumi/dev Created stack 'dev' Installing dependencies... Creating virtual environment... Finished creating virtual environment Updating pip, setuptools, and wheel in virtual environment... ... ... Finished installing dependencies Your new project is ready to go! To perform an initial deployment, run `pulumi up` ``` -------------------------------- ### Initialize Pulumi Go Project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/languages-sdks/go Demonstrates how to create a new Pulumi project using the Go language template from an empty directory. This sets up the basic project structure including Pulumi.yaml and main.go. ```Shell mkdir myproject && cd myproject pulumi new go ``` -------------------------------- ### List Azure account locations Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/azure/create-project Uses the Azure CLI to list all available Azure regions in a table format. ```shell $ az account list-locations --output table ``` -------------------------------- ### installPluginFromServer API Method Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/reference/pkg/nodejs/pulumi/pulumi/interfaces/automation.Workspace Installs a plugin in the workspace, for example to use cloud providers like AWS or GCP. ```APIDOC installPluginFromServer(name: string, version: string, server: string): Promise name: string - The name of the plugin. version: string - The version of the plugin e.g. "v1.0.0". server: string - The server to install the plugin into Returns: Promise ``` -------------------------------- ### Curl Example: Get Yearly Resource Summary Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/resources-under-management Example `curl` command to retrieve yearly resource count summaries for the last 730 days. ```bash curl \ -h "accept: application/vnd.pulumi+8" \ -h "authorization: token $PULUMI_ACCESS_TOKEN" \ --compressed \ https://api.pulumi.com/api/orgs/{organization}/resources/summary?granularity=yearly&lookbackDays=730 ``` -------------------------------- ### Deploying Infrastructure with CLI Commands Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/concepts/vs/opentofu These command-line snippets illustrate the typical deployment workflows for OpenTofu and Pulumi. They show the distinct commands used to initialize, plan, and apply infrastructure changes with each tool. ```Bash # OpenTofu Deployment Workflow opentofu init opentofu plan opentofu apply ``` ```Bash # Pulumi Deployment Workflow pulumi up ``` -------------------------------- ### Set Up Python Virtual Environment and Install Dependencies Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/extending-pulumi/build-a-component These shell commands create a Python virtual environment, activate it, and then install the project dependencies listed in `requirements.txt` using `pip`. ```Shell python -m venv venv source venv/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Curl Example: Get Monthly Resource Summary Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/resources-under-management Example `curl` command to retrieve monthly resource count summaries for the last 90 days. ```bash curl \ -h "accept: application/vnd.pulumi+8" \ -h "authorization: token $PULUMI_ACCESS_TOKEN" \ --compressed \ https://api.pulumi.com/api/orgs/{organization}/resources/summary?granularity=monthly&lookbackDays=90 ``` -------------------------------- ### Curl Example: Get Weekly Resource Summary Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/resources-under-management Example `curl` command to retrieve weekly resource count summaries for the last 28 days. ```bash curl \ -h "accept: application/vnd.pulumi+8" \ -h "authorization: token $PULUMI_ACCESS_TOKEN" \ --compressed \ https://api.pulumi.com/api/orgs/{organization}/resources/summary?granularity=weekly&lookbackDays=28 ``` -------------------------------- ### Pulumi .NET Application Entry Point with Deployment.Run Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/reference/pkg/dotnet/Pulumi/Pulumi.Deployment Demonstrates the basic structure for a Pulumi .NET application's `Main` method, using `Deployment.Run` to encapsulate resource creation logic. Cloud resources must be created within the lambda passed to `Run` or `RunAsync` to ensure proper asynchronous execution and error handling. ```C# static Task Main(string[] args) { // program initialization code ... return Deployment.Run(async () => { // Code that creates resources. }); } ``` -------------------------------- ### Curl Example: Get Daily Resource Summary Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/resources-under-management Example `curl` command to retrieve daily resource count summaries for the last 2 days. ```bash curl \ -H "Accept: application/vnd.pulumi+8" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ --compressed \ https://api.pulumi.com/api/orgs/{organization}/resources/summary?granularity=daily&lookbackDays=2 ``` -------------------------------- ### Deploy S3 Static Website with Pulumi in Go Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api This Go code demonstrates how to configure an AWS S3 bucket for static website hosting, including setting up website configuration, public access blocks, ownership controls, and uploading an `index.html` file. It also shows how to export the website endpoint. ```Go website, err := s3.NewBucketWebsiteConfigurationV2(ctx, "website", &s3.BucketWebsiteConfigurationV2Args{ Bucket: siteBucket.ID(), IndexDocument: &s3.BucketWebsiteConfigurationV2IndexDocumentArgs{ Suffix: pulumi.String("index.html"), }, }) if err != nil { return err } // Upload our index.html. if _, err := s3.NewBucketObject(ctx, "index", &s3.BucketObjectArgs{ Bucket: siteBucket.ID(), // Reference to the s3.Bucket object. Content: pulumi.String(indexContent), Acl: pulumi.String("public-read"), Key: pulumi.String("index.html"), // Set the key of the object. ContentType: pulumi.String("text/html; charset=utf-8"), // Set the MIME type of the file. }, pulumi.DependsOn([]pulumi.Resource{ publicAccessBlock, ownershipControls, website, })); err != nil { return err } // Export the website URL. ctx.Export("websiteUrl", website.WebsiteEndpoint) return nil } ``` -------------------------------- ### Download Kubernetes Guestbook All-in-One YAML Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/adopting-pulumi/migrating-to-pulumi/from-kubernetes Downloads the 'guestbook-all-in-one.yaml' file from the Kubernetes examples repository, which contains the complete configuration for the Guestbook application. This file is used as input for the subsequent Pulumi examples. ```shell curl -L --remote-name \ https://raw.githubusercontent.com/kubernetes/examples/master/guestbook/all-in-one/guestbook-all-in-one.yaml ``` -------------------------------- ### Curl Example: Get Hourly Resource Summary Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/resources-under-management Example `curl` command to retrieve hourly resource count summaries for the last day. Note: If specifying `granularity=hourly`, the maximum `lookbackDays` you can set is `2`. ```bash curl \ -h "accept: application/vnd.pulumi+8" \ -h "authorization: token $PULUMI_ACCESS_TOKEN" \ --compressed \ https://api.pulumi.com/api/orgs/{organization}/resources/summary?granularity=hourly&lookbackDays=1 ``` -------------------------------- ### Initialize File Provider Project Directory Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/extending-pulumi/build-a-provider Commands to create a new directory for the custom Pulumi file provider code and navigate into it, setting up the project's root. ```bash $ mkdir file-provider $ cd file-provider ``` -------------------------------- ### Example Current Deployment Settings for Patch Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/deployments Illustrates the initial state of deployment settings before a patch operation is applied, showing source context and operation context. ```json { "sourceContext": { "git": { "repoURL": "https://github.com/pulumi/deploy-demos.git", "branch": "refs/heads/demo", "repoDir": "pulumi-programs/aws-ts-s3" } }, "operationContext": { "preRunCommands": [ "echo \"hello world\"" ], "environmentVariables": { "AWS_REGION": "us-west-2", "AWS_ACCESS_KEY_ID": "$AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY": "$AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN": "$AWS_SESSION_TOKEN" } } } ``` -------------------------------- ### Install Pulumi Plugin Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/reference/pkg/nodejs/pulumi/pulumi/interfaces/automation.Workspace Installs a plugin in the workspace from a remote server, for example a third-party plugin. ```APIDOC installPlugin(name: string, version: string, kind?: string): Promise Parameters: name: string The name of the plugin. version: string The version of the plugin e.g. "v1.0.0". kind: string (Optional) The kind of plugin e.g. "resource" Returns: Promise ``` -------------------------------- ### Pulumi .NET Application Entry Point: Deployment.RunAsync Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/reference/pkg/dotnet/Pulumi/Pulumi.Deployment Describes RunAsync as the entry point for Pulumi .NET applications. It handles startup logic, instantiates a new stack instance, and ensures asynchronous resource construction is properly reported by returning or awaiting the Task. Cloud resources must be created within the Pulumi.Deployment.Stack component. ```C# static Task Main(string[] args) { // program initialization code ... return Deployment.Run(serviceProvider); } ``` ```APIDOC Pulumi.Deployment.RunAsync(IServiceProvider serviceProvider) Description: An entry-point to a Pulumi application. .NET applications should perform all startup logic they need in their `Main` method and then end with returning or awaiting this function. Deployment will instantiate a new stack instance based on the type passed as TStack type parameter using the serviceProvider. Cloud resources cannot be created outside of the Pulumi.Deployment.Stack component. Declaration: public static Task RunAsync(IServiceProvider serviceProvider) where TStack : Stack Parameters: serviceProvider: IServiceProvider Returns: Type: Task Type Parameters: TStack ``` -------------------------------- ### Example: Get Pulumi Insights Account with curl Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/insight-accounts Illustrates how to retrieve details for a specific Pulumi Insights account using a `curl` command. This example sends a GET request with the account name in the path. ```curl curl \ -H "Accept: application/vnd.pulumi+6" \ -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ https://api.pulumi.com/api/preview/insights/pulumi/accounts/FizzBuzz%20AWS%20Staging ``` -------------------------------- ### Install Pulumi CLI on Linux/macOS with curl Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/kubernetes/begin Installs the Pulumi CLI using a curl script, suitable for various Linux distributions and macOS. This provides an alternative installation method. ```shell $ curl -fsSL https://get.pulumi.com | sh ``` -------------------------------- ### Initialize a new Pulumi project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/cli/commands/pulumi Demonstrates how to start a new Pulumi project using the `pulumi new` command, which prompts for cloud and language choices. ```shell $ pulumi new ``` -------------------------------- ### Verify Pulumi CLI Installation Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/aws/begin Checks the installed Pulumi CLI version to confirm successful installation. Examples are provided for both Unix-like terminals and Windows PowerShell, along with a common troubleshooting tip to restart the terminal if the command is not found. ```bash $ pulumi version v3.177.0 ``` ```powershell > pulumi version v3.177.0 ``` -------------------------------- ### Bash: Initialize Pulumi YAML Program Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/extending-pulumi/build-a-provider These shell commands demonstrate how to set up a new Pulumi YAML program directory. It navigates to the parent directory, creates a new project folder, enters it, and initializes a basic Pulumi YAML stack. ```bash $ cd .. $ mkdir use-file-provider $ cd use-file-provider $ pulumi new yaml ``` -------------------------------- ### Verify Pulumi CLI Installation Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/kubernetes/begin Checks the installed version of the Pulumi CLI to confirm successful installation. If the command fails, restarting the terminal or checking the PATH environment variable may be necessary. ```shell $ pulumi version ``` ```powershell > pulumi version ``` -------------------------------- ### Create a new Pulumi Azure project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/azure/create-project Initializes a new Pulumi project with basic scaffolding for Azure, using the specified language runtime. This command creates a new directory, navigates into it, and then runs `pulumi new`. ```shell $ mkdir quickstart && cd quickstart $ pulumi new azure-typescript ``` ```shell $ mkdir quickstart && cd quickstart $ pulumi new azure-python ``` ```shell $ mkdir quickstart && cd quickstart $ pulumi new azure-csharp ``` ```shell $ mkdir quickstart && cd quickstart $ pulumi new azure-go ``` ```shell $ mkdir quickstart && cd quickstart $ pulumi new azure-java ``` ```shell $ mkdir quickstart && cd quickstart $ pulumi new azure-yaml ``` -------------------------------- ### Install Pulumi ESC CLI using curl script Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/esc/get-started/begin Installs the Pulumi ESC CLI on Linux or macOS by downloading and executing the official Pulumi ESC installation script via curl. ```shell $ curl -fsSL https://get.pulumi.com/esc/install.sh | sh ``` -------------------------------- ### Initialize Git repository and commit Pulumi project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/deployments/get-started/deployments-using-cli This snippet illustrates the process of initializing a local Git repository within the newly created Pulumi project directory. It includes commands to set the default branch name to 'main', add all project files to the staging area, and perform the initial commit with a descriptive message. ```bash $ git init hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch hint: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and hint: 'development'. The just-created branch can be renamed via this command: hint: hint: git branch -m Initialized empty Git repository in /home/cleve/code/test_deployments/.git/ $ git branch -M main $ git add . $ git commit -m "first commit" [main (root-commit) 5b22a59] first commit 7 files changed, 2454 insertions(+) create mode 100644 .gitignore create mode 100644 Pulumi.dev.yaml create mode 100644 Pulumi.yaml create mode 100644 index.ts create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 tsconfig.json ``` -------------------------------- ### Initialize New Pulumi .NET Project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/languages-sdks/dotnet These commands demonstrate how to create a new Pulumi project using a specific .NET language template (C#, F#, or Visual Basic). Each command sequence first creates and navigates into a new directory, then runs `pulumi new` with the desired language template name. This sets up the basic project structure and files, including `Pulumi.yaml` and language-specific project and program files. ```Shell $ mkdir myproject && cd myproject $ pulumi new csharp ``` ```Shell $ mkdir myproject && cd myproject $ pulumi new fsharp ``` ```Shell $ mkdir myproject && cd myproject $ pulumi new visualbasic ``` -------------------------------- ### Authenticate Pulumi CLI for Private GitHub/GitLab Repositories Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/idp/get-started/private-registry Describes how to authenticate the Pulumi CLI when working with private GitHub or GitLab repositories. It requires a `GITHUB_TOKEN` or `GITLAB_TOKEN` environment variable for commands like `publish`, `get schema`, `install`, and `up`. The example shows how to set `GITHUB_TOKEN` using `gh auth token`. ```bash GITHUB_TOKEN="$(gh auth token)" pulumi package publish COMPONENT_LOCATION ``` -------------------------------- ### Go: Pulumi Provider Main Entrypoint Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/extending-pulumi/build-a-provider This Go code defines the `main` function, which serves as the entry point for the Pulumi provider. It constructs the provider instance using `infer.NewProviderBuilder`, registers the `File` resource, sets the namespace, and runs the provider process. ```go func main() { provider, err := infer.NewProviderBuilder(). WithResources( infer.Resource(File{}), ).WithNamespace("example"). Build() if err != nil { fmt.Fprintf(os.Stderr, "Error: %s", err.Error()) os.Exit(1) } err := provider.Run(context.Background(), "file", "0.1.0") if err != nil { fmt.Fprintf(os.Stderr, "Error: %s", err.Error()) os.Exit(1) } } ``` -------------------------------- ### Install Pulumi ESC CLI using Homebrew Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/esc/get-started/begin Installs the Pulumi ESC CLI on macOS using Homebrew. This command first updates Homebrew and then installs the `esc` package from the official Pulumi tap. ```shell $ brew update && brew install pulumi/tap/esc ``` -------------------------------- ### Example Pulumi Stack README Markdown Template Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/projects-and-stacks This is an example of a `Pulumi.README.md` file, which serves as a template for the Stack README. It includes links to monitoring tools and operational information, demonstrating how dynamic content can be rendered in the Pulumi Cloud UI. ```Markdown # Pulumi Cloud README [Sign in to AWS to view stack resources!](https://top-secret-url.com) ## On Call Operations ### Monitor 1. [Cloudwatch Metrics](https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#dashboards:name=${outputs.dashboardName}): Monitor holistic metrics tracking overall service health 2. [RDS Performance Metrics](https://us-west-2.console.aws.amazon.com/rds/home?region=us-west-2#performance-insights-v20206:/resourceId/${database.databaseCluster.id}/resourceName/${outputs.rdsClusterWriterInstance}): Monitor RDS performance (wait times, top queries) 3. [Cloudwatch Logs](https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logStream:group=${outputs.cloudwatchLogGroup}): Search across service logs ``` -------------------------------- ### Install Pulumi CLI on Windows with Chocolatey Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/kubernetes/begin Installs the Pulumi CLI on Windows using Chocolatey, a package manager for Windows. This method assumes PowerShell is being used. ```powershell > choco install pulumi ``` -------------------------------- ### Initialize a New Pulumi Kubernetes Project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/clouds/kubernetes/guides/try-out-the-cluster This snippet demonstrates how to create a new Pulumi project specifically for Kubernetes using the Pulumi CLI. It sets up the basic project structure for your chosen language. ```TypeScript mkdir my-k8s-app && cd my-k8s-app pulumi new kubernetes-typescript ``` ```Python mkdir my-k8s-app && cd my-k8s-app pulumi new kubernetes-python ``` ```Go mkdir my-k8s-app && cd my-k8s-app pulumi new kubernetes-go ``` ```C# mkdir my-k8s-app && cd my-k8s-app pulumi new kubernetes-csharp ``` -------------------------------- ### Install Pulumi CLI on macOS with Homebrew Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/kubernetes/begin Installs the Pulumi CLI using Homebrew, a package manager for macOS and Linux. This is the recommended method for these operating systems. ```shell $ brew install pulumi/tap/pulumi ``` -------------------------------- ### Install Pulumi Plugin from Remote Server Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/reference/pkg/python/pulumi Installs a plugin in the Workspace from a remote server, for example a third party plugin. ```APIDOC install_plugin_from_server(name: str, version: str, server: str) -> None name: The name of the plugin to install. version: The version to install. server: The server to install from. ``` -------------------------------- ### Example Pulumi Preview Output (Compliant Stack) Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/crossguard/get-started Illustrative output from a `pulumi preview` command showing a compliant stack update. It confirms the resources to be created and indicates that the Policy Pack was successfully run without violations. ```Shell Previewing update (dev): Type Name Plan + pulumi:pulumi:Stack test-dev create + └─ aws:s3:Bucket my-bucket create Resources: + 2 to create Policy Packs run: Name Version aws-typescript (/Users/user/path/to/policy-pack) (local) ``` ```Shell Previewing update (dev): Type Name Plan + pulumi:pulumi:Stack test-dev create + └─ aws:s3:Bucket my-bucket create Resources: + 2 to create Policy Packs run: Name Version aws-python (/Users/user/path/to/policy-pack) (local) ``` -------------------------------- ### Install Pulumi Plugin in Workspace Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/reference/pkg/python/pulumi Installs a plugin in the Workspace, for example to use cloud providers like AWS or GCP. ```APIDOC install_plugin(name: str, version: str, kind: str = 'resource') -> None name: The name of the plugin to install. version: The version to install. kind: The kind of plugin. ``` -------------------------------- ### Define AWS API Gateway Request Lambda Authorizer with Pulumi Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/clouds/aws/guides/api-gateway This example demonstrates how to create a custom AWS Lambda function to act as a request authorizer for an API Gateway using Pulumi. It shows how to validate requests based on a hard-coded 'Authorization' header token and integrate the authorizer with a GET route on a Pulumi AWS API Gateway RestAPI. The Python example also includes IAM role setup for the Lambda. ```JavaScript "use strict"; const aws = require("@pulumi/aws"); const apigateway = require("@pulumi/aws-apigateway"); const authorizer = new aws.lambda.CallbackFunction("authorizer", { callback: async (event, context) => { const effect = event.headers.Authorization === "token a-good-token" ? "Allow" : "Deny"; return { principalId: "my-user", policyDocument: { Version: "2012-10-17", Statement: [ { Action: "execute-api:Invoke", Effect: effect, Resource: event.methodArn, }, ], }, }; }, }); const api = new apigateway.RestAPI("api", { routes: [ { path: "/", method: "GET", localPath: "www", authorizers: [ { authType: "custom", parameterName: "Authorization", type: "request", identitySource: ["method.request.header.Authorization"], handler: authorizer, }, ], }, ], }); exports.url = api.url; ``` ```TypeScript import * as aws from "@pulumi/aws"; import * as apigateway from "@pulumi/aws-apigateway"; const authorizer = new aws.lambda.CallbackFunction("authorizer", { callback: async (event: any, context) => { const effect = event.headers.Authorization === "token a-good-token" ? "Allow" : "Deny"; return { principalId: "my-user", policyDocument: { Version: "2012-10-17", Statement: [ { Action: "execute-api:Invoke", Effect: effect, Resource: event.methodArn, }, ], }, }; }, }); const api = new apigateway.RestAPI("api", { routes: [ { path: "/", method: "GET", localPath: "www", authorizers: [ { authType: "custom", parameterName: "Authorization", type: "request", identitySource: ["method.request.header.Authorization"], handler: authorizer, }, ], }, ], }); export const url = api.url; ``` ```Python import json import pulumi import pulumi_aws as aws import pulumi_aws_apigateway as apigateway role = aws.iam.Role( "role", assume_role_policy=json.dumps( { "Version": "2012-10-17", "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com", }, } ], } ), managed_policy_arns=[aws.iam.ManagedPolicy.AWS_LAMBDA_BASIC_EXECUTION_ROLE], ) authorizer = aws.lambda_.Function( "authorizer", runtime="python3.9", handler="handler.handler", role=role.arn, code=pulumi.FileArchive("./authorizer"), ) api = apigateway.RestAPI( ``` -------------------------------- ### Minimal Pulumi Provider Implementation in Go Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/extending-pulumi/pulumi-provider-sdk This Go code demonstrates how to create a basic Pulumi provider named 'greetings' using the Pulumi Provider SDK. It defines a 'HelloWorld' resource with 'name' and 'loud' input parameters, and a 'Message' output. The example showcases the `main` function, provider creation using `infer`, resource struct definitions (`HelloWorld`, `HelloWorldArgs`, `HelloWorldState`), and the `Create` method implementation. ```Go func main() { p.RunProvider("greetings", "0.1.0", provider()) } // Create the provider using infer func provider() p.Provider { return infer.Provider(infer.Options{ Resources: []infer.InferredResource{ infer.Resource(&HelloWorld{}), }, })) } // Each resource has a controlling struct. type HelloWorld struct{} // Each resource has in input struct, defining what arguments it accepts. type HelloWorldArgs { // Fields projected into Pulumi must be public and hava a `pulumi:"..."` tag. // The pulumi tag doesn't need to match the field name, but its generally a // good idea. Name string `pulumi:"name"` // Fields marked `optional` are optional, so they should have a pointer // ahead of their type. Loud *bool `pulumi:"loud,optional"` } // Each resource has a state, describing the fields that exist on the created resource. type HelloWorldState { // It is generally a good idea to embed args in outputs, but it isn't strictly necessary. HelloWorldArgs // Here we define a required output called message. Message string `pulumi:"message"` } // All resources must implement Create at a minimum. func (HelloWorld) Create( ctx context.Context, name string, input HelloWorldArgs, preview bool, ) (string, HelloWorldState, error) { state := HelloWorldState{HelloWorldArgs: input} if preview { return name, state, nil } state.Message = fmt.Sprintf("Hello, %s", input.Name) if input.Loud != nil && *input.Loud { state.Message = strings.ToUpper(state.Message) } return name, state, nil } ``` -------------------------------- ### Initialize New Pulumi Project Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/cli/commands Demonstrates how to start a new Pulumi project using the `pulumi new` command. This command interactively prompts the user to select a cloud provider and programming language for the new project. ```Shell $ pulumi new ``` -------------------------------- ### Define Pulumi Component Entry Point in C# Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/concepts/resources/components This C# example illustrates how to create a `Program.cs` file and use `Pulumi.Experimental.Provider.ComponentProviderHost.Serve` to establish the entry point for a Pulumi C# component. ```C# using System.Threading.Tasks; class Program { public static Task Main(string []args) => Pulumi.Experimental.Provider.ComponentProviderHost.Serve(args); } ``` -------------------------------- ### Example: Get Pulumi Deployment Details (curl) Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/deployments A curl command example demonstrating how to retrieve details for a specific Pulumi deployment using its unique ID. ```curl curl -XGET -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ --location "https://api.pulumi.com/api/stacks/my-org/aws-ts-s3-folder/dev/deployments/9e5e1331-a018-4845-8714-1598ba8dc52e" ``` -------------------------------- ### Download Kubernetes Guestbook YAML Files Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/adopting-pulumi/migrating-to-pulumi/from-kubernetes Commands to create a `yaml` directory and download the necessary Kubernetes Guestbook application YAML files from the official Kubernetes examples GitHub repository. ```shell $ mkdir yaml $ pushd yaml $ curl -L --remote-name \ "https://raw.githubusercontent.com/kubernetes/examples/master/guestbook/{frontend-deployment,frontend-service,redis-master-deployment,redis-master-service,redis-replica-deployment,redis-replica-service}.yaml" $ popd ``` -------------------------------- ### Example: Get Pulumi Stack Downstream References with cURL Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/stacks Example cURL command to retrieve downstream references for a specific Pulumi stack. ```curl curl \ -H "Accept: application/vnd.pulumi+8" \ -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/downstreamreferences ``` -------------------------------- ### Install Python Dependencies on Debian/Ubuntu Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api This command installs essential Python packages (python3-venv and python3-pip) on Debian/Ubuntu systems using apt. These are crucial for managing Python environments and dependencies in Pulumi Python projects. ```bash sudo apt install python3-venv python3-pip ``` -------------------------------- ### Deploy S3 Static Website with Pulumi in C# Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/automation-api/getting-started-automation-api This C# code illustrates the process of creating an AWS S3 bucket for static website hosting. It covers defining bucket ownership controls, public access blocks, website configuration, and uploading the `index.html` content, finally exporting the website URL. ```C# var program = PulumiFn.Create(() => { // Create a bucket and expose a website index document. var siteBucket = new Pulumi.Aws.S3.Bucket("s3-website-bucket"); const string indexContent = @" Hello S3

Hello, world!

Made with ❤️ with Pulumi

"; var ownershipControls = new Aws.S3.BucketOwnershipControls("ownership-controls", new() { Bucket = siteBucket.Id, Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs { ObjectOwnership = "ObjectWriter", }, }); var publicAccessBlock = new Aws.S3.BucketPublicAccessBlock("public-access-block", new() { Bucket = siteBucket.Id, BlockPublicAcls = false, }); var website = new Aws.S3.BucketWebsiteConfigurationV2("website", new() { Bucket = siteBucket.Id, IndexDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2IndexDocumentArgs { Suffix = "index.html", }, }); // Write our index.html into the site bucket. var @object = new Pulumi.Aws.S3.BucketObject("index", new Pulumi.Aws.S3.BucketObjectArgs { Bucket = siteBucket.BucketName, // Reference to the s3 bucket object. Content = indexContent, Acl = "public-read", Key = "index.html", // Set the key of the object. ContentType = "text/html; charset=utf-8", // Set the MIME type of the file. }, new CustomResourceOptions { DependsOn = { publicAccessBlock, ownershipControls, website, }, }); // Export the website url. return new Dictionary { ["website_url"] = website.WebsiteEndpoint }; }); ``` -------------------------------- ### Example: Adding a Pulumi Component and Importing its Python SDK Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/extending-pulumi/build-a-component This example demonstrates the `pulumi package add` command using a specific GitHub repository and release version. It shows the command's output, including the successful generation of a Python SDK, and provides the corresponding Python import statement for using the component in your code. ```Shell $ pulumi package add https://github.com/pulumi/staticpagecomponent@v0.1.0 Downloading provider: github.com_pulumi_staticpagecomponent.git Successfully generated a Python SDK for the staticpagecomponent package at /example/use-static-page-component/sdks/staticpagecomponent [...] ``` ```Python import pulumi_static_page_component as static_page_component ``` -------------------------------- ### Example: Get Stack Resource Count with cURL Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/stacks Demonstrates how to make a cURL request to get the resource count for a Pulumi stack, requiring an access token. ```curl curl \ -H "Accept: application/vnd.pulumi+8" \ -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/resources/count ``` -------------------------------- ### Install Pulumi CLI on Windows Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/gcp/begin This command installs the Pulumi CLI on Windows systems using the Chocolatey package manager. It's the recommended approach for Windows users to quickly set up the Pulumi command-line interface in PowerShell. ```powershell > choco install pulumi ``` -------------------------------- ### Install Pulumi CLI on macOS and Linux Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/get-started/gcp/begin These commands demonstrate how to install the Pulumi CLI on macOS using Homebrew or on Linux using a direct curl script. These methods ensure the 'pulumi' command-line tool is available for use in your terminal. ```bash $ brew install pulumi/tap/pulumi ``` ```bash $ curl -fsSL https://get.pulumi.com | sh ``` -------------------------------- ### Example: Get Pulumi Stack Details with cURL Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/stacks Example cURL command to retrieve details for a specific Pulumi stack using its organization, project, and stack names. ```curl curl \ -H "Accept: application/vnd.pulumi+8" \ -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ https://api.pulumi.com/api/stacks/{organization}/{project}/{stack} ``` -------------------------------- ### Pulumi Package Add Command Syntax and Usage Examples Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/cli/commands/pulumi_package_add Demonstrates the general syntax for `pulumi package add` and provides examples for adding packages from different sources: a local provider, a schema file, a Git repository, and how to pass provider-specific parameters. ```CLI pulumi package add [provider-parameter...] [flags] ``` ```CLI pulumi package add ./my-provider ``` ```CLI pulumi package add ./my/schema.json ``` ```CLI pulumi package add example.org/org/repo.git/path[@] ``` ```CLI pulumi package add – –provider-parameter-flag value ``` -------------------------------- ### Curl Example: Retrieve Policy Violations Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/policy-results An example `curl` command demonstrating how to make an authenticated GET request to the Pulumi API to list policy violations for a given organization. ```shell curl \ -H "Accept: application/vnd.pulumi+8" \ -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ https://api.pulumi.com/api/orgs/{organization}/policyresults/violationsv2 ``` -------------------------------- ### Initialize Pulumi Component Project Directory Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/extending-pulumi/build-a-component Commands to create a new directory for a Pulumi component project and navigate into it, preparing for component development. ```Bash $ mkdir static-page-component $ cd static-page-component ``` -------------------------------- ### Example: Retrieve a specific environment variable with Pulumi ESC CLI Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/esc/get-started/store-and-retrieve-secrets Shows a concrete example of using `esc env get` to retrieve the 'myEnvironment' variable from 'my-project/dev-environment'. ```shell esc env get my-project/dev-environment myEnvironment ``` -------------------------------- ### Get Pulumi Registry Template (cURL) Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/registry Example cURL command to retrieve information about a registry template. It sends a GET request to the specified endpoint, requiring an authorization token. ```curl curl \ -H "Accept: application/vnd.pulumi+8" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ https://api.pulumi.com/api/preview/registry/templates/{source}/{publisher}/{name}/versions/{version} ``` -------------------------------- ### Build and Deploy Pulumi Go Infrastructure Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/languages-sdks/go Shows the commands to build a Pulumi Go program and then deploy the declared infrastructure using pulumi up. This step applies the infrastructure changes to your cloud provider. ```Shell go build -o $(basename $(pwd)) ``` ```Shell pulumi up ``` -------------------------------- ### Pulumi Automation PluginInstallOptions Class API Reference Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/reference/pkg/dotnet/Pulumi.Automation/Pulumi.Automation.PluginInstallOptions Detailed API documentation for the `PluginInstallOptions` class, including its properties and their usage for configuring Pulumi plugin installations. ```APIDOC Class: PluginInstallOptions Namespace: Pulumi.Automation Assembly: Pulumi.Automation.dll Inheritance: object Syntax: public class PluginInstallOptions Properties: ExactVersion: Description: If 'true', force installation of an exact version match (usually >= is accepted). Defaults to 'false'. Declaration: public bool ExactVersion { get; set; } Type: bool ServerUrl: Description: A URL to download plugins from. Declaration: public string? ServerUrl { get; set; } Type: string ``` -------------------------------- ### Example: Get Pulumi ESC Environment Details with cURL Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/environments Demonstrates how to make a GET request using cURL to retrieve details of an environment. Requires an Authorization token and specifies Accept/Content-Type headers. ```curl curl \ -H "Accept: application/vnd.pulumi+8" \ -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ --request GET \ https://api.pulumi.com/api/esc/environments/{organization}/{project}/{environment} ``` -------------------------------- ### Install Pulumi Compliance Ready Policy Package Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/crossguard/compliance-ready-policies This command shows how to install a new Pulumi Compliance Ready Policy package using npm. This example installs the `@pulumi/aws-compliance-policies` package, enabling its use within a Pulumi project to enforce AWS-specific compliance rules. ```shell npm install --save @pulumi/aws-compliance-policies ``` -------------------------------- ### Pulumi CLI Output for Kubernetes Guestbook Deployment Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/adopting-pulumi/migrating-to-pulumi/from-kubernetes This snippet shows the console output from running `pulumi up` to deploy the Kubernetes guestbook example. It details the creation of various Kubernetes resources, including Services and Deployments, and highlights the exported `privateIp` output. ```Shell Updating (dev) Type Name Status + pulumi:pulumi:Stack pulumi-k8s-test-dev created + └─ kubernetes:yaml:ConfigGroup guestbook created + ├─ kubernetes:yaml:ConfigFile foo-test/redis-replica-service.yaml created + │ └─ kubernetes:core/v1:Service redis-replica created + ├─ kubernetes:yaml:ConfigFile foo-test/frontend-deployment.yaml created + │ └─ kubernetes:apps/v1:Deployment frontend created + ├─ kubernetes:yaml:ConfigFile foo-test/redis-master-deployment.yaml created + │ └─ kubernetes:apps/v1:Deployment redis-master created + ├─ kubernetes:yaml:ConfigFile foo-test/frontend-service.yaml created + │ └─ kubernetes:core/v1:Service frontend created + ├─ kubernetes:yaml:ConfigFile foo-test/redis-master-service.yaml created + │ └─ kubernetes:core/v1:Service redis-master created + └─ kubernetes:yaml:ConfigFile foo-test/redis-replica-deployment.yaml created + └─ kubernetes:apps/v1:Deployment redis-replica created Outputs: privateIp: "10.108.151.100" Resources: + 14 created ``` -------------------------------- ### Example Curl Request to List Pulumi Organization Deployments Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/pulumi-cloud/reference/deployments Provides a `curl` command example to demonstrate how to make an authenticated GET request to the Pulumi API to list organization deployments, including pagination parameters. ```bash curl -XGET -H "Content-Type: application/json" \ -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ --location "https://api.pulumi.com/api/orgs/my-org/deployments?page=1&pageSize=5" ``` -------------------------------- ### Full Codefresh Pipeline for Pulumi Deployment Source: https://www.pulumi.com/registry/packages/gcp/api-docs/secretmanager/iac/using-pulumi/continuous-delivery/codefresh This comprehensive `codefresh.yml` example outlines a multi-stage CI/CD pipeline for deploying a Pulumi project. It includes steps for cloning the repository, installing project dependencies (yarn install), selecting a Kubernetes cluster context, and finally deploying the Pulumi stack using `pulumi login`, `pulumi stack select`, `pulumi stack`, and `pulumi up --non-interactive --yes`. ```YAML version: '1.0' stages: - prepare - build - deploy steps: main_clone: title: Cloning main repository... type: git-clone repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}' revision: '${{CF_REVISION}}' stage: prepare git: github-1 BuildProject: title: Build project stage: build image: pulumi/pulumi commands: - yarn install SelectMyCluster: title: Select K8s cluster stage: deploy image: codefresh/kubectl:1.13.3 commands: - kubectl config get-contexts - kubectl config use-context "kostis-demo@FirstKubernetes" RunPulumi: title: Deploying stage: deploy image: pulumi/pulumi commands: - pulumi login - pulumi stack select dev # (Optional) Use pulumi stack to get more information in CI/CD logs about the current stack - pulumi stack - pulumi up --non-interactive --yes ```