Compare commits

...

1 Commits

Author SHA1 Message Date
Adrien Delorme
390e4c4916 Document plugin requirement block usage 2020-11-12 14:08:18 +01:00
2 changed files with 55 additions and 0 deletions

View File

@ -35,6 +35,12 @@ following sections.
## Specifying a Required Packer Version
```hcl
packer {
required_version = ">= 1.2.0, < 2.0.0"
}
```
The `required_version` setting accepts a [version constraint
string,](#version-constraints) which specifies which versions of Packer
can be used with your configuration.
@ -46,6 +52,7 @@ Use Packer version constraints in a collaborative environment to
ensure that everyone is using a specific Packer version, or using at least
a minimum Packer version that has behavior expected by the configuration.
`@include 'from-1.5/specifying-required-plugins.mdx'`
## Version Constraints

View File

@ -0,0 +1,48 @@
## Specifying Required Plugins
```hcl
packer {
required_builders {
mybuilder = {
source = "mycorp/mybuilder"
version = "~> 1.0"
}
}
required_provisioners {
myprovisioner = {
source = "mycorp/myprovisioner"
version = "~> 2.0"
}
}
required_postprocessors {
mypostprocessor = {
source = "mycorp/mypostprocessor"
version = "~> 3.0"
}
}
}
source "mybuilder" "example" {}
build {
sources = ["source.mybuilder.example"]
provisioner "myprovisioner" {}
post-processor "mypostprocessor" {}
}
```
The `required_*` plugin blocks must be nested inside the top-level `packer`
block (which can also contain other settings).
Each argument in a required plugin block enables one plugin. The key determines
the plugin's local name (its unique identifier within the configuration), and
the value is an object with the following elements:
* source - the global source address for the plugin you intend to use, such as
`hashicorp/packer-builder-amazon-ebs`.
* version - a [version constraint string](#version-constraints) specifying
which subset of available plugin versions the module is compatible with.