Files
Packer-Cn/website/content/partials/plugins/plugin-location.mdx
Wilken Rivera 9c85fc274a Update plugin loading documentation (#12485)
Packer checks a number of directories for plugins upon initialization,
with the introduction of multi-component plugins and underlying changes
to the Packer SDK the ordering changed slightly. These changes update
the related documentation to reflect the new ordering, and adds a plugin
loading ordering section to the docs to help users discover how plugin
loading works.

Include in this change are updates to the PACKER_CONFIG_DIR environment
variables to reflect the XDG base directory specification used as the
default Packer configuration directory layout.

* Update website/content/docs/configure.mdx
2023-07-06 16:00:36 -04:00

26 lines
1.6 KiB
Plaintext

Upon the initialization of Packer, any externally installed plugin will be automatically
discovered and loaded.
Packer plugins will usually be located within a plugins sub-directory under Packer's main config directory
[PACKER_CONFIG_DIR](/packer/docs/configure#packer-s-config-directory). If `PACKER_CONFIG_DIR` is
either not set or empty, a default equal to `$HOME/.config/packer/plugins` on UNIX, or `%APPDATA%\packer.d\plugins`
for Windows, will be used.
Where applicable, some installation processes such as `packer init` may override the plugin loading process.
Refer to the specific installation guides for any plugin loading overrides.
Packer uses the following process for loading the correct plugin:
1. All directories under the `PACKER_PLUGIN_PATH` environment variable, if `PACKER_PLUGIN_PATH`
is set. The `PACKER_PLUGIN_PATH` takes precedences over all other plugin directories; no other directories will be checked.
1. The directory where `packer` is installed, or the executable directory.
1. The current working directory, where `packer build` is being invoked. (`"."`)
1. The `PACKER_CONFIG_DIR/plugins` directory. `PACKER_CONFIG_DIR` refers to *[Packer's config
directory](/packer/docs/configure#packer-s-config-directory)*, if it could be found.
-> **Note:** The `PACKER_PLUGIN_PATH` environment variable can be set to more that one directories;
for example, ~/custom-dir-1:~/custom-dir-2. Separate directories in the PATH string using a colon (:) on UNIX systems
and a semicolon (;) on Windows systems. The above example path would be able to find a single or multi-component plugin
in either `~/custom-dir-1/packer/` or `~/custom-dir-2/`.