Setting up VS Code for Bolt

Sections

Bolt configuration and inventory files, as well as content such as plans and task metadata, conform to particular specifications. Making your development environment aware of these specifications gives you real-time validation and data type checking as you write, speeding up the development cycle and reducing errors.

Validating configuration and inventory files with JSON schemas

You can validate Bolt's configuration and inventory files using JSON schemas provided through the Puppet Forge. Configuring Visual Studio Code (VS Code) to use Bolt's JSON schemas enables VS Code's live IntelliSense feature, which gives you functionality like code completion and parameter info for available fields in the files.

Bolt offers the following JSON schemas:

Bolt fileJSON schema
bolt-defaults.yamlhttps://forgeapi.puppet.com/schemas/bolt-defaults.json
bolt-project.yamlhttps://forgeapi.puppet.com/schemas/bolt-project.json
inventory.yamlhttps://forgeapi.puppet.com/schemas/bolt-inventory.json

Enabling schemas

To start using the JSON schemas with VS Code, follow these steps:

  1. Install the YAML extension.

  2. Open the user or workspace settings file and add the following JSON:

    {
      "yaml.schemas": {
        "https://forgeapi.puppet.com/schemas/bolt-defaults.json": [
          "bolt-defaults.yaml"
        ],
        "https://forgeapi.puppet.com/schemas/bolt-project.json": [
          "bolt-project.yaml"
        ],
        "https://forgeapi.puppet.com/schemas/bolt-inventory.json": [
          "inventory.yaml"
        ]
      }
    }

📖 Related information

Developing Bolt content with the Puppet VS Code Extension

Puppet offers a VS Code Extension that you can use when developing content for your Bolt project. The Puppet VS Code Extension includes many powerful features, including validation for task metadata files, live Intellisense for Puppet plans, validating Puppetfiles, and more.

To install the Puppet VS Code Extension, see How to start using the Puppet VS Code Extension.

📖 Related information

Puppet sites use proprietary and third-party cookies. By using our sites, you agree to our cookie policy.