From 1896739a4c13919b27231121fe2830d3e7b1839b Mon Sep 17 00:00:00 2001 From: Karthik P Date: Thu, 6 Mar 2025 22:36:03 +0530 Subject: [PATCH] docs: add installing plugins from a compiled binary example --- .../content/docs/plugins/creation/index.mdx | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/website/content/docs/plugins/creation/index.mdx b/website/content/docs/plugins/creation/index.mdx index 898fb61e4..9a981eb41 100644 --- a/website/content/docs/plugins/creation/index.mdx +++ b/website/content/docs/plugins/creation/index.mdx @@ -247,16 +247,31 @@ scope of a plugin. ### Testing Plugins -Making your unpublished plugin available to Packer is possible by either: +To install plugins from local source, you can use the `packer plugins install` command with the `--path` flag: -- Starting Packer from the directory where the plugin binary is located. -- Putting the plugin binary in the same directory as Packer. +```shell-session +$ packer plugins install --path // +``` + +For example let's install happycloud plugin from a locally sourced binary + +```shell-session +$ packer plugins install --path packer-plugin-happycloud github.com/hashicorp/happycloud +``` -In both these cases, if the binary is called `packer-plugin-myawesomecloud` and -defines an `ebs` builder then you will be able to use an `myawesomecloud-ebs` -builder or source without needing to have a `required_plugin` block. +This will install the happycloud plugin from the `packer-plugin-happycloud` binary so Packer can discover it. +If you want to use this in an HCL2 template, you can optionally add it to the `required_plugins` section like so: + +```hcl + required_plugins { + happycloud = { + source = "github.com/hashicorp/happycloud" + version = ">=0.0.1" + } +} +``` -This is extremely useful during development. +For further information on how Packer discovers and loads plugins, you may refer to our [documentation](/packer/docs/plugins/creation/plugin-load-spec) on the subject. ### Distributing Plugins