<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joyful Lee</title>
    <description>The latest articles on DEV Community by Joyful Lee (@joyfullee).</description>
    <link>https://dev.to/joyfullee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3294776%2F0d2c27f5-c4e3-4d48-86c7-4ce762b77435.jpg</url>
      <title>DEV Community: Joyful Lee</title>
      <link>https://dev.to/joyfullee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joyfullee"/>
    <language>en</language>
    <item>
      <title>Setting Up a Productive Puppet Dev Environment with VS Code</title>
      <dc:creator>Joyful Lee</dc:creator>
      <pubDate>Mon, 11 Aug 2025 20:48:34 +0000</pubDate>
      <link>https://dev.to/joyfullee/setting-up-a-productive-puppet-dev-environment-with-vs-code-o6l</link>
      <guid>https://dev.to/joyfullee/setting-up-a-productive-puppet-dev-environment-with-vs-code-o6l</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;As a Puppet Professional Services Engineer, I've had the opportunity to observe the development workflows and code editing practices of dozens of teams. One of the most consistent issues I’ve seen is a lack of consistency in Puppet codebases: code that’s hard to read, maintain, or reason about. This isn’t just an aesthetic problem. Inconsistent code makes upgrades harder, contributes to technical debt, and makes new team members less confident when contributing.&lt;/p&gt;

&lt;p&gt;I believe many of these issues stem from the development environment, or more often, the lack of one. Few teams have clear standards for how engineers should work with Puppet day to day. Even when they do, those standards are rarely enforced or adopted consistently. Most engineers just bring their existing habits into Puppet development: a beloved Vim config, a long-standing reliance on Notepad++, or maybe even no real tooling at all.&lt;/p&gt;

&lt;p&gt;VS Code has emerged as a powerful and approachable editor for Puppet development. But many engineers don’t realize how much better their experience can be with the right setup. This post walks through how to build a productive Puppet dev environment with VS Code, PDK, Git, and the Puppet VS Code extension. These tools are cross-platform, modern, and battle-tested.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;This guide assumes some basic familiarity with Puppet concepts like modules, manifests, and Git repositories. You should already have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/setup/setup-overview" rel="noopener noreferrer"&gt;Visual Studio Code installed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/docs/sourcecontrol/overview" rel="noopener noreferrer"&gt;Git installed&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything in this guide—VS Code, Git, PDK, and the Puppet extension—is fully supported on Windows, macOS, and Linux, including ARM-based systems. This makes it a solid choice for teams working across platforms.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing the Essentials
&lt;/h3&gt;

&lt;p&gt;Assuming you already have VS Code and Git installed, the next step is to install Puppet Development Kit (PDK). Do this &lt;em&gt;before&lt;/em&gt; installing the VS Code extension. PDK provides the managed Ruby environment, core Puppet libraries, testing tools, and CLI helpers that power the extension.&lt;/p&gt;

&lt;p&gt;Starting with PDK 3.5.0, packages are stored in protected repositories but remain free for development use. You can read more about &lt;a href="https://help.puppet.com/pdk/3/topics/pdk_install.htm" rel="noopener noreferrer"&gt;how to install PDK&lt;/a&gt; and &lt;a href="https://help.puppet.com/core/current/Content/PuppetCore/access_core_for_test_dev.htm" rel="noopener noreferrer"&gt;its licensing model&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once PDK is installed, install the Puppet VS Code extension from &lt;a href="https://puppet-vscode.github.io/" rel="noopener noreferrer"&gt;its homepage&lt;/a&gt; or directly from &lt;a href="https://marketplace.visualstudio.com/items?itemName=puppet.puppet-vscode" rel="noopener noreferrer"&gt;the VS Code Marketplace&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To verify everything is working:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a &lt;code&gt;.pp&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Look for the Puppet version in the status bar (lower right), showing the version provided by PDK.&lt;/li&gt;
&lt;li&gt;Confirm syntax highlighting, warnings, and linting are active.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jd3ocs9a6fc42yhbtvx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jd3ocs9a6fc42yhbtvx.png" alt="VS Code showing Puppet extension installed and loaded" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up Your Workspace
&lt;/h3&gt;

&lt;p&gt;Puppet environments often involve multiple Git repositories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;a href="https://help.puppet.com/pe/current/topics/control_repo.htm" rel="noopener noreferrer"&gt;control repo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Repos for custom modules&lt;/li&gt;
&lt;li&gt;Possibly third-party modules or separate Hiera data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To get started, open a terminal in VS Code (&lt;code&gt;Ctrl+`&lt;/code&gt; or from the menu: Terminal → New Terminal) and clone the repositories you work on. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/my-org/control-repo.git
git clone https://github.com/my-org/my_custom_module.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After cloning, use the VS Code GUI to create your workspace:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;control-repo&lt;/code&gt; directory in VS Code.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;File → Add Folder to Workspace...&lt;/strong&gt; and select your module or Hiera directories.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;File → Save Workspace As...&lt;/strong&gt; and save your workspace file somewhere convenient.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This setup creates a multi-root workspace, which lets you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Track changes to each repo independently in the Source Control panel&lt;/li&gt;
&lt;li&gt;Apply consistent settings across the workspace&lt;/li&gt;
&lt;li&gt;Quickly navigate between files in different repos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compared to opening a single directory that contains all your projects, this approach avoids Git confusion, lets you commit changes per repo, and helps VS Code keep things organized.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15wrmceqr53r2rzjk9ax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F15wrmceqr53r2rzjk9ax.png" alt="Adding a folder to the VS Code workspace" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6hnf8a7u20ng8ytz0h4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6hnf8a7u20ng8ytz0h4.png" alt="Saving your VS Code workspace" width="800" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using PDK in Practice
&lt;/h3&gt;

&lt;p&gt;Once your environment is set up, it’s time to put PDK to work. PDK streamlines many common development tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Creating new modules:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  pdk new module my_module
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Validating code:&lt;/strong&gt;
Run static analysis and syntax checks with:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  pdk validate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Running unit tests:&lt;/strong&gt;
If your module includes RSpec tests:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  pdk &lt;span class="nb"&gt;test &lt;/span&gt;unit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Managing Ruby dependencies:&lt;/strong&gt;
Use &lt;code&gt;pdk bundle&lt;/code&gt; to run tools like &lt;code&gt;rspec&lt;/code&gt;, &lt;code&gt;rubocop&lt;/code&gt;, or &lt;code&gt;rake&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  pdk bundle &lt;span class="nb"&gt;exec &lt;/span&gt;rake spec
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PDK helps standardize development practices across your team. It ensures that everyone is using the same tools, settings, and code structure, even if they’re working on different operating systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Powering Up with the VS Code Extension
&lt;/h3&gt;

&lt;p&gt;The Puppet extension adds rich language support for &lt;code&gt;.pp&lt;/code&gt;, &lt;code&gt;.epp&lt;/code&gt;, and &lt;code&gt;.yaml&lt;/code&gt; files used in Puppet development. Features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Syntax highlighting and automatic formatting&lt;/li&gt;
&lt;li&gt;Autocompletion and hover info for Puppet types and functions&lt;/li&gt;
&lt;li&gt;Inline linting and error diagnostics&lt;/li&gt;
&lt;li&gt;"Go to definition" and "Find all references" support&lt;/li&gt;
&lt;li&gt;Built-in tasks for running &lt;code&gt;pdk validate&lt;/code&gt;, &lt;code&gt;pdk test&lt;/code&gt;, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The extension integrates tightly with PDK and uses the Puppet Language Server under the hood. It’s especially useful for surfacing errors as you type and for learning available parameters and types.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5kkistc0w5n77bc03qb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5kkistc0w5n77bc03qb.png" alt="Formatting manifests with the Puppet extension" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Git Integration and Development Workflow
&lt;/h3&gt;

&lt;p&gt;VS Code’s built-in Git support works seamlessly with Puppet projects. Some tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Commit changes per repo directly from the Source Control panel&lt;/li&gt;
&lt;li&gt;View diffs, stage changes, and create branches in the UI&lt;/li&gt;
&lt;li&gt;Use extensions like GitLens to view commit history and annotations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also configure &lt;code&gt;.gitignore&lt;/code&gt; and &lt;code&gt;.editorconfig&lt;/code&gt; files to enforce consistency across your team’s repos. This ensures that everyone’s editor behaves the same and avoids committing untracked build files or system-specific configs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynnw0htuuh7670lqk8jn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fynnw0htuuh7670lqk8jn.png" alt="Creating a feature branch" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgs5y1qfkv6puvv6n00o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgs5y1qfkv6puvv6n00o.png" alt="Committing changes in the Source Control panel" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Tips and Best Practices
&lt;/h3&gt;

&lt;p&gt;Here are a few additional recommendations to get the most out of your environment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enable autosave&lt;/strong&gt; in VS Code to avoid losing changes between test runs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use workspace settings&lt;/strong&gt; to enforce tab width, line endings, and trimming of trailing whitespace&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add an &lt;code&gt;.editorconfig&lt;/code&gt; file&lt;/strong&gt; to your repos to standardize formatting across editors&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install recommended extensions&lt;/strong&gt; like YAML support, GitLens, and Markdown Preview for working on docs. Migrating from Vim? Check out the &lt;a href="https://marketplace.visualstudio.com/items?itemName=vscodevim.vim" rel="noopener noreferrer"&gt;Vim extension&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leverage command palette shortcuts&lt;/strong&gt; like &lt;code&gt;Ctrl+Shift+P → PDK: Validate&lt;/code&gt; to run tasks without switching to terminal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwr0pyez7sciizy53jbze.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwr0pyez7sciizy53jbze.png" alt="Validating code with PDK using a task" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Troubleshooting and Gotchas
&lt;/h3&gt;

&lt;p&gt;Even with a solid setup, things can go sideways. Here are a few common issues and how to fix them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Puppet version not showing in the status bar?&lt;/strong&gt;&lt;br&gt;
Make sure PDK was installed before the VS Code extension.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Syntax highlighting not working?&lt;/strong&gt;&lt;br&gt;
Check that you're editing a &lt;code&gt;.pp&lt;/code&gt; file in a workspace with PDK configured.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;pdk validate&lt;/code&gt; complains about missing gems or dependencies?&lt;/strong&gt;&lt;br&gt;
Run &lt;code&gt;pdk bundle install&lt;/code&gt; in the module directory to refresh the environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Puppet Language Server crashes or stops responding?&lt;/strong&gt;&lt;br&gt;
Try reloading the VS Code window (&lt;code&gt;Ctrl+Shift+P → Reload Window&lt;/code&gt;) or reinstalling the extension.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Working with legacy modules?&lt;/strong&gt;&lt;br&gt;
Use &lt;code&gt;pdk convert&lt;/code&gt; to migrate older modules into a PDK-managed structure.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;With the right environment, Puppet development becomes faster, safer, and more collaborative. VS Code, PDK, and the Puppet extension together offer a powerful toolkit that works across platforms and team sizes.&lt;/p&gt;

&lt;p&gt;Whether you're working solo or collaborating across a large team, investing a little time in your setup can pay big dividends in confidence, clarity, and maintainability.&lt;/p&gt;

&lt;p&gt;Give it a try, and let me know how it goes! If you’ve got questions, tips, or feedback, feel free to drop them in the comments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dgnpr38e8jf9605pl4g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dgnpr38e8jf9605pl4g.jpg" alt="Full Puppet production VS Code setup" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>puppet</category>
      <category>vscode</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
