🤔Introduction
The Puppet Development Kit (PDK) provides a simple and consistent interface to a set of useful tools for everyone who develops or consumes Puppet code. Puppet Development Kit made it simpler than ever to design and test Puppet modules. In this article, we will study various aspects related to Puppet Development Kit.

🌐Installing Puppet Development Kit
Before installing PDK, ensure your system and language versions meet the requirements. PDK supports Puppet 4 or later.
Only modules generated or converted using PDK are supported for PDK functions like class creation, testing, and validation.
In this article, I will walk you through the installation process of windows and ubuntu. You can review this documentation for your system.
📜Install Puppet Development Kit on Windows
We can install PDK on windows using downloading and installing packages or using chocolatey, a package manager for windows.
⚙️Installing with Chocolatey
Firstly download chocolatey to your system if you haven't. Then follow the below steps to install Puppet.
⏩Run choco install PDK to install PDK.
⏩Open a PowerShell window to re-source your profile and make PDK available to your PATH.
🚨PDK loads automatically on PowerShell 4.0 and subsequent versions, and pdk commands are available at the prompt. You must add the PowerShell module to your profile in PowerShell 2.0 or 3.0.
⭐Note: Run choco upgrade pdk to upgrade to the most recent package.
⚙️Download and Install the Package
⏩Download the package from the PDK download site.
⏩Open a new PowerShell window to re-source your profile and make PDK available to your PATH.
⚙️Add the Puppet Development Kit module to Powershell
If you are using Powershell version 2.0 or 3.0, the PDK module doesn't load automatically, so we do it manually.
⏩Add the below module to the PowerShell profile:
`Import-Module-Name "$($env:ProgramFiles)\WindowsPowerShell\Modules\PuppetDevelopmentKit"`
⏩Open a new PowerShell window to re-source your profile and make PDK available to your PATH.
After adding the module, PDK will automatically load when you open PowerShell.
📜Installing Puppet Development Kit on Ubuntu
🎯Install PDK with the help of APT Package Manager.
🎯Download and install the software and its dependencies. Use the below command appropriate to your system.
⚙️For Ubuntu 18.04
wget https://apt.puppet.com/puppet-tools-release-bionic.deb
sudo dpkg -i puppet-tools-release-bionic.deb
sudo apt-get update
sudo apt-get install pdk
⚙️For Ubuntu 20.04
wget https://apt.puppet.com/puppet-tools-release-focal.deb
sudo dpkg -i puppet-tools-release-focal.deb
sudo apt-get update
sudo apt-get install pdk
Now, open a new terminal to re-source your profile and make PDK available to your PATH.
⭐To upgrade your PDK module, run the following command:
sudo apt-get update
sudo apt-get install pdk
After installing, you might want to upgrade PDK to the latest version to get new features, improvements, fixes, etc. So, let's see how to upgrade our PDK version.
🌐Upgrading Puppet Development Kit
Use the same procedure you did to install PDK when upgrading it. Then, update your modules to incorporate any modifications to the module template.
📜Update a Module with Template Changes
Update your module to keep it current with PDK or custom module template changes.
Based on the template you used to generate or convert your module, the pdk update function changes your module. PDK updates your module to reflect those changes if that template has undergone modifications.
👉To check for template changes without making any modifications run the following command:
Run update with the --noop option.
This "noop" option executes the command in "no operation" mode, which displays the proposed modifications but doesn't carry them out.
👉Now, coming to the important part, follow the below steps to update a module:
Change into the module's directory with cd <MODULE_NAME> with the command line interface.
👉Run the below update command:
pdk update
👉If any module metadata is missing, interact with PDK prompts to provide metadata information.
👉Confirm the change summary PDK displays and either continue or cancel the update.
PDK creates a thorough change report, update report.txt, in the top directory of the module whether you approve or reject modifications. Each time you issue the update command, this report is updated.
⭐Note: PDK updates the module with the reported changes if approved.
So far, we have seen how to install and update modules in PDK, but how to create one? In the further article, I will walk you through creating a module.
🌐Creating Modules
The Puppet Development Kit creates classes, defined types, and tasks in your module and generates a brand-new module that includes all necessary metadata. It also creates the infrastructure needed to test and validate your module.
PDK prompts you with several questions to establish the metadata for your module. If you choose to skip a question, PDK will use the default response for that question. Your responses to these inquiries are recorded and utilized as the new defaults for subsequently created modules. Optionally, you can use the default responses for all metadata and omit the interview process.
With command line parameters, you can override the default template used by PDK to produce the empty module.
⭐Note: Before you add classes or new code to a module you've already created, validate and test it first. You can use this to check if the module files and directories were produced properly.
By executing pdk commands after the module has been validated, you can add classes, defined types, and tasks to your module.
The manifest and test file templates are created for the class or defined by the new class and defined type commands.
📜Create a Module
The pdk new module command generates a default module skeleton and testing templates.
👉Run the new module command using the module's name as a parameter from the command line: pdk new module <MODULE_NAME>
👉Add the skip-interview flag to the command: pdk new module <MODULE_NAME> --skip-interview. This will optionally bypass the interview questions and create the module with default metadata settings.
👉Answer the dialog questions. Each question indicates the default value it will use if you press Enter.
Some of the dialog questions are:
✍️Forge username
✍️Version
✍️Author
✍️License
✍️Operating System Support
✍️Description
✍️Source code repository
✍️Where others can learn more
✍️Where others can report issues
In the end, confirm or cancel the module creation.
⭐Note: Make sure the PDK package is installed. Ensure that the appropriate environment variables are added if you are running PDK behind a proxy. Details can be found in the instructions for running PDK behind a proxy.
After creating a module, we can create a class, a defined type, and a task.
⭐To create a class, run the following command:
pdk new class <CLASS_NAME>
⭐To create a defined-type run the following command:
pdk new defined_type <DEFINED_TYPE_NAME>
⭐To create a task, run the following command:
pdk new task <TASK_NAME>
After following the above, we can create our custom modules. But how to convert our custom modules into standardized ones? Well, let's look into that.



