This change allows users to disable the loading of vendored plugins by setting legacy mode off.
In this mode Packer will rely only on plugins that have been installed via packer init or the packer plugins command.
```
// Running validate on JSON with Packer legacy mode unset; all plugins loaded by default
~> go run . validate ../packer-templates/amazon-ebs/amazon-ebs_ubuntu_shell_manifest.json
Legacy JSON Configuration Mode enabled.
The template will be parsed in the legacy configuration style. Legacy style
templates will continue to work but users are encouraged to move HCL style templates.
templates will continue to work but users are encouraged to move to HCL style templates.
See: https://learn.hashicorp.com/tutorials/packer/hcl2-upgrade
In JSON mode automatic loading of vendored plugins is enabled by default. In future
this feature will be removed and Packer will rely only on system installed plugins.
To disable automatic loading of vendored plugins set PACKER_LEGACY_MODE=off
See: https://packer.io/docs/templates/legacy-mode
The configuration is valid.
// Running validate on JSON with Packer legacy mode explicitly set to on; all plugins loded
~> PACKER_LEGACY_MODE=on go run . validate ../packer-templates/amazon-ebs/amazon-ebs_ubuntu_shell_manifest.json
The configuration is valid.
// Running validate on JSON with Packer legacy mode explicitly set to off
~> PACKER_LEGACY_MODE=off go run . validate ../packer-templates/amazon-ebs/amazon-ebs_ubuntu_shell_manifest.json
Legacy JSON Configuration Mode enabled.
The template will be parsed in the legacy configuration style. Legacy style
templates will continue to work but users are encouraged to move HCL style templates.
templates will continue to work but users are encouraged to move to HCL style templates.
See: https://learn.hashicorp.com/tutorials/packer/hcl2-upgrade
In JSON mode automatic loading of vendored plugins is enabled by default. In future
this feature will be removed and Packer will rely only on system installed plugins.
To disable automatic loading of vendored plugins set PACKER_LEGACY_MODE=off
See: https://packer.io/docs/templates/legacy-mode
Error: Failed to initialize build "amazon-ebs"
error initializing builder 'amazon-ebs': Unknown builder amazon-ebs
exit status 1
```
In the legacy mode users running build or validate with JSON templates will get a
warning indicating that Packer is in Legacy Configuration Mode.
Legacy mode can be controlled by a environment variable.
PACKER_LEGACY_MODE=auto // default if not set will display warnings to the user.
PACKER_LEGACY_MODE=off // will display warnings to the user when running, and may disable other features.
PACKER_LEGACY_MODE=on // will not display warnings with all legacy features enabled.
```
~> go run . validate ../packer-templates/amazon-chroot/amazon-chroot_shell.json
Legacy JSON Configuration Mode enabled.
The template will be parsed in the legacy configuration style. Legacy style
templates will continue to work but users are encouraged to move HCL style templates.
templates will continue to work but users are encouraged to move to HCL style templates.
See: https://learn.hashicorp.com/tutorials/packer/hcl2-upgrade
The configuration is valid.
~> PACKER_LEGACY_MODE=on go run . validate ../packer-templates/amazon-chroot/amazon-chroot_shell.json
The configuration is valid.
```
* evaluateLocalVariables: modify code for readability and some (not benchmarked) perfs
* Make default input variable type the DynamicPseudoType
This should be the default, and avoids a panic. This type can represent situations where a type is not yet known. Its meaning is undefined in cty.
* do not take Empty types from default value
* Update types.variables.go
Co-authored-by: Wilken Rivera <[email protected]>
The auto installation of external plugins via packer init only work for
HCL templates. Since we have not officially removed all plugins (slated
for 1.8.0) I am reverting this test change. Once 1.7.9 is released we
can begin removing plugins and optimizing the redirect experience for
JSON-only users.
* Add variable interpolation support to hcp_packer_registry block
* Add tests for variable interpolation in hcp_packer_registry block
* Add variable interpolation support to the build block (#11425)
* Add simple test to build command
* add test for crash
* fix
* show more precise error message when parse of a provisioner fails
* Revert "fix"
This reverts commit fc88e89fbb.
* add better severity