Add redirects for all vendored plugins

This change allows users of HCL2 templates to run packer init against a
HCL file that has no required_plugin block and have it automatically
install the latest version, when PACKER_LEGACY_MODE=off.
If a required_plugins block is in the config that will take precedence
over the implicitly required logic.

```
// Running init against template with required plugin block for github.com/hashicorp/amazon v1.0.1
~>  PACKER_LEGACY_MODE=on go run . init ../packer-templates/amazon-ebs/amazon-ebs_ubuntu_shell-local.pkr.hcl
Installed plugin github.com/hashicorp/amazon v1.0.1 in "~/.packer.d/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.0.1_x5.0_darwin_amd64"

// Running init against template with no required plugin block after a successful init for github.com/hashicorp/amazon v1.0.1
~>  PACKER_LEGACY_MODE=on go run . init ../packer-templates/amazon-ebs/amazon-ebs_ubuntu_shell-local.pkr.hcl

// Running init against template with no required plugin block and no previously installed plugins on the system
~>  rm ~/.packer.d/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.0.1_x5.0_darwin_amd64
~>  PACKER_LEGACY_MODE=off go run . init ../packer-templates/amazon-ebs/amazon-ebs_ubuntu_shell-local.pkr.hcl
Installed implicitly required plugin github.com/hashicorp/amazon v1.0.8 in "~/.packer.d/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.0.8_x5.0_darwin_amd64"

Warning, at least one component used in your config file(s) has moved out of
Packer into the "github.com/hashicorp/amazon" plugin and is now being implicitly required.
For more details on implicitly required plugins see https://packer.io/docs/commands/init#implicit-required-plugin

To avoid any backward incompatible changes with your
config file you may want to lock the plugin version by pasting the following to your config:

packer {
  required_plugins {
    amazon = {
      source  = "github.com/hashicorp/amazon"
      version = "~> v1.0.8"
    }
  }
}
```
wilken/implicitly-required-plugins-legacy-mode
Wilken Rivera 4 years ago
parent 323ecdd31b
commit e7d249fd5f

@ -326,67 +326,67 @@ func loadConfig() (*config, error) {
// BuilderRedirects
BuilderRedirects: map[string]string{
//"amazon-chroot": "github.com/hashicorp/amazon",
//"amazon-ebs": "github.com/hashicorp/amazon",
//"amazon-ebssurrogate": "github.com/hashicorp/amazon",
//"amazon-ebsvolume": "github.com/hashicorp/amazon",
//"amazon-instance": "github.com/hashicorp/amazon",
"amazon-chroot": "github.com/hashicorp/amazon",
"amazon-ebs": "github.com/hashicorp/amazon",
"amazon-ebssurrogate": "github.com/hashicorp/amazon",
"amazon-ebsvolume": "github.com/hashicorp/amazon",
"amazon-instance": "github.com/hashicorp/amazon",
//"azure-arm": "github.com/hashicorp/azure",
//"azure-chroot": "github.com/hashicorp/azure",
//"azure-dtl": "github.com/hashicorp/azure",
"azure-arm": "github.com/hashicorp/azure",
"azure-chroot": "github.com/hashicorp/azure",
"azure-dtl": "github.com/hashicorp/azure",
//"docker": "github.com/hashicorp/docker",
"docker": "github.com/hashicorp/docker",
//"exoscale": "github.com/exoscale/exoscale",
"exoscale": "github.com/exoscale/exoscale",
//"googlecompute": "github.com/hashicorp/googlecompute",
"googlecompute": "github.com/hashicorp/googlecompute",
//"parallels-iso": "github.com/hashicorp/parallels",
//"parallels-pvm": "github.com/hashicorp/parallels",
"parallels-iso": "github.com/hashicorp/parallels",
"parallels-pvm": "github.com/hashicorp/parallels",
//"qemu": "github.com/hashicorp/qemu",
"qemu": "github.com/hashicorp/qemu",
//"vagrant": "github.com/hashicorp/vagrant",
"vagrant": "github.com/hashicorp/vagrant",
//"virtualbox-iso": "github.com/hashicorp/virtualbox",
//"virtualbox-ovf": "github.com/hashicorp/virtualbox",
//"virtualbox-vm": "github.com/hashicorp/virtualbox",
"virtualbox-iso": "github.com/hashicorp/virtualbox",
"virtualbox-ovf": "github.com/hashicorp/virtualbox",
"virtualbox-vm": "github.com/hashicorp/virtualbox",
//"vmware-iso": "github.com/hashicorp/vmware",
//"vmware-vmx": "github.com/hashicorp/vmware",
"vmware-iso": "github.com/hashicorp/vmware",
"vmware-vmx": "github.com/hashicorp/vmware",
//"vsphere-iso": "github.com/hashicorp/vsphere",
//"vsphere-clone": "github.com/hashicorp/vsphere",
"vsphere-iso": "github.com/hashicorp/vsphere",
"vsphere-clone": "github.com/hashicorp/vsphere",
},
DatasourceRedirects: map[string]string{
//"amazon-ami": "github.com/hashicorp/amazon",
//"amazon-secretsmanager": "github.com/hashicorp/amazon",
"amazon-ami": "github.com/hashicorp/amazon",
"amazon-secretsmanager": "github.com/hashicorp/amazon",
},
ProvisionerRedirects: map[string]string{
//"ansible": "github.com/hashicorp/ansible",
//"ansible-local": "github.com/hashicorp/ansible",
"ansible": "github.com/hashicorp/ansible",
"ansible-local": "github.com/hashicorp/ansible",
//"azure-dtlartifact": "github.com/hashicorp/azure",
"azure-dtlartifact": "github.com/hashicorp/azure",
},
PostProcessorRedirects: map[string]string{
//"amazon-import": "github.com/hashicorp/amazon",
"amazon-import": "github.com/hashicorp/amazon",
//"docker-import": "github.com/hashicorp/docker",
//"docker-push": "github.com/hashicorp/docker",
//"docker-save": "github.com/hashicorp/docker",
//"docker-tag": "github.com/hashicorp/docker",
"docker-import": "github.com/hashicorp/docker",
"docker-push": "github.com/hashicorp/docker",
"docker-save": "github.com/hashicorp/docker",
"docker-tag": "github.com/hashicorp/docker",
//"googlecompute-export": "github.com/hashicorp/googlecompute",
//"googlecompute-import": "github.com/hashicorp/googlecompute",
"googlecompute-export": "github.com/hashicorp/googlecompute",
"googlecompute-import": "github.com/hashicorp/googlecompute",
//"exoscale-import": "github.com/exoscale/exoscale",
"exoscale-import": "github.com/exoscale/exoscale",
//"vagrant": "github.com/hashicorp/vagrant",
//"vagrant-cloud": "github.com/hashicorp/vagrant",
"vagrant": "github.com/hashicorp/vagrant",
"vagrant-cloud": "github.com/hashicorp/vagrant",
//"vsphere": "github.com/hashicorp/vsphere",
//"vsphere-template": "github.com/hashicorp/vsphere",
"vsphere": "github.com/hashicorp/vsphere",
"vsphere-template": "github.com/hashicorp/vsphere",
},
}
if err := config.Plugins.Discover(); err != nil {

Loading…
Cancel
Save