55 lines
2.4 KiB
Plaintext
Raw Permalink Normal View History

Plugins will usually be located in the
[PACKER_HOME_DIR](/docs/configure#packer-s-home-directory).
* [`packer init`](/docs/commands/init) will install plugins in the **last** directory
in the following numbered list.
* During the initialization of Packer, any plugin required in the
**`required_plugins`** section will be looked up in all entries of the following
list. **First** plugin found takes precedence. Two binaries of the same plugin
with two different version will be considered as two different plugins. Highest
found version matching `required_plugins` will be taken into consideration.
1. The directory where `packer` is, or the executable directory.
1. The current working directory. (`"."`)
1. The `PACKER_HOME_DIR/plugins` directory. PACKER_HOME_DIR refers to *[Packer's home
directory](/docs/configure#packer-s-home-directory)*, if it could be found.
1. The director(y/ies) under the `PACKER_PLUGIN_PATH` env var, if `PACKER_PLUGIN_PATH`
is set.
~> **Note**: There can be more than one directory in the `PACKER_PLUGIN_PATH`
env var, it will be seperated by a semicolon (`;`) on Windows systems and a
colon (`:`) on other systems. The order priority will be kept.
Using the following example :
```hcl
required_plugins {
myawesomecloud = {
version = ">= 2.7.0"
source = "azr/myawesomecloud"
}
happycloud = ">= 2.7.0"
}
```
The plugin getter will then install the binaries in the following location for a
system with no `PACKER_PLUGIN_PATH` env var set.
* `PACKER_HOME_DIR/plugins/github.com/azr/myawesomecloud/`
* `PACKER_HOME_DIR/plugins/github.com/hashicorp/happycloud/`
During initialization, on a `darwin_amd64` system, Packer will look-up for the
following files:
* `PACKER_EXEC_DIR/github.com/azr/myawesomecloud/packer-plugin-myawesomecloud_*_darwin_amd64_x5`
* `./github.com/azr/myawesomecloud/packer-plugin-myawesomecloud_*_darwin_amd64_x5`
* `PACKER_HOME_DIR/plugins/github.com/azr/myawesomecloud/packer-plugin-myawesomecloud_*_darwin_amd64_x5`
* `PACKER_PLUGIN_PATH/github.com/azr/myawesomecloud/packer-plugin-myawesomecloud_*_darwin_amd64_x5`
* `./packer-plugin-myawesomecloud`
The first plugin-name/version files found will take precedence.
-> Note: `PACKER_HOME_DIR` is not an actual env var and refers to [Packer's home
directory](#packer-s-home-directory). `PACKER_EXEC_DIR` is not an actual env var
and refers to the directory where `packer` is, or the executable directory.