Using Pulumi ESC with VS Code
The Pulumi Tools extension for VS Code allows you to manage your Pulumi ESC environments directly from your editor. This enables you to create and manage environments, secrets and configuration directly within the IDE with rich IDE features.
Prerequisites
Before you begin, ensure you have the following installed:
Getting Started with Pulumi ESC in VS Code
The Visual Studio Code Pulumi Tools extension lets you manage your ESC without having to leave VS Code.
Open the ESC Explorer
From the primary sidebar, open the Pulumi ESC Explorer view, and click login to authenticate to Pulumi Cloud.
Once logged in, you will see a tree of your organizations and, within each organization, your ESC environments.
Create a project and environment
To create a new ESC project and environment:
- In the ESC Explorer, locate your organization
- Click the plus (+) icon next to your org
- Enter a name for your project and environment
The extension will open up an editor with an example environment definition you can then edit.
Create an environment in an existing project
To create a new ESC within an existing project:
- In the ESC Explorer, locate your organization and project
- Click the plus (+) icon next to your project
- Enter a name for environment
Edit an existing environment
To edit an existing environment:
- Click on an environment in the ESC Explorer tree
- Make your changes in the editor
- Save the file to create a new revision of the environment
Each time you save changes to an environment, a new revision is created. Revisions provide version control for your environments, allowing you to track changes over time and revert to previous versions if needed. You can view all revisions of an environment by expanding the environment node in the ESC Explorer.
Opening an environment
When you open
an environment in Pulumi ESC, we will decrypt any secrets, invoke any dynamic providers, and resolve all configuration values. This lets you view the fully resolved environment with all variables expanded and secrets decrypted in your chosen output format.
To open and preview an environment:
- Select an environment in the editor
- Click the Preview button in the editor’s top-right corner
- Select your desired output format when prompted
Decrypting an environment
Decryption is the process of unlocking the encrypted secrets within an environment without performing a full environment opening operation. This is particularly useful when you need to:
- Move environment data between projects or organizations
- Clone environments with their secrets intact
To decrypt an environment:
- Hover over the environment in the ESC Explorer
- Click the decrypt icon that appears to the right
Deleting an environment
To delete an environment:
- Hover over the environment in the ESC Explorer
- Click the delete (trash) icon that appears
- Confirm the deletion by entering the environment name when prompted
Refreshing environments
The extension automatically refreshes after changes, but you can manually refresh by:
- Clicking the refresh icon at the top right of the ESC Explorer tree view
Searching environments
To search for specific environments:
- Click the search icon in the top right of the ESC Explorer
- Type your search term
- View results in the panel that appears
Tagging revisions
To tag a specific revision:
- Locate the revision in the ESC Explorer, by clicking on the expand icon of your environment
- Choose your revision and click the tag icon
- Enter a name for the tag
Running ESC commands in the terminal
You can quickly generate ESC Run commands for execution in the terminal:
- Hover over the environment in the ESC Explorer
- Click the Add to terminal icon that appears
- The appropriate command will be populated in your terminal
Go to definition/find all references
The extension supports standard code navigation features:
- Go to Definition: Quickly navigate to symbol definitions
- Find all References: Locate all references to symbols, interpolations, and values
Comparing Environments and Revisions
To compare two environments or revisions:
- Right-click (or control-click) the first node to compare
- Choose Select for compare
- Right-click (or control-click) on another node
- Select Compare with selected
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.