Packer "required_plugins" missing from template in CI
packer init only installs plugins that a required_plugins block inside a packer {} stanza names. If the block is missing or omits your builder, init installs nothing and build fails on an unknown type.
What this error means
packer init reports nothing to install, then packer build fails with an unknown builder or "is not installed" because the plugin was never declared.
Error: Unknown builder type: amazon-ebs
on build.pkr.hcl line 12:
(source code not available)
known builder types: file, nullCommon causes
No required_plugins block for the builder
The template uses amazon-ebs but never declares the amazon plugin in a packer { required_plugins { ... } } stanza, so init has nothing to fetch.
The plugin source or version is wrong
A typo in the source path or an unsatisfiable version constraint means init cannot resolve the plugin you intended.
How to fix it
Declare the plugin in required_plugins
- Add a
packer {}stanza with arequired_pluginsblock. - Name each plugin with its
sourceand aversionconstraint. - Run
packer initso the declared plugins install.
packer {
required_plugins {
amazon = {
source = "github.com/hashicorp/amazon"
version = ">= 1.2.0"
}
}
}Verify the source path and version
Match the source exactly to the plugin repository and use a constraint that has a published release.
How to prevent it
- Declare every builder and provisioner plugin in
required_plugins. - Pin a version constraint that has published releases.
- Run
packer initin CI so the declared plugins are actually fetched.