diff --git a/provisioner/chef-client/provisioner.go b/provisioner/chef-client/provisioner.go index 5d9fb751a..572b88212 100644 --- a/provisioner/chef-client/provisioner.go +++ b/provisioner/chef-client/provisioner.go @@ -235,6 +235,14 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { return fmt.Errorf("Error uploading encrypted data bag secret: %s", err) } } + + if p.config.ValidationKeyPath != "" { + remoteValidationKeyPath = fmt.Sprintf("%s/validation.pem", p.config.StagingDir) + if err := p.uploadFile(ui, comm, remoteValidationKeyPath, p.config.ValidationKeyPath); err != nil { + return fmt.Errorf("Error copying validation key: %s", err) + } + } + configPath, err := p.createConfig( ui, comm, @@ -250,13 +258,6 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { return fmt.Errorf("Error creating Chef config file: %s", err) } - if p.config.ValidationKeyPath != "" { - remoteValidationKeyPath = fmt.Sprintf("%s/validation.pem", p.config.StagingDir) - if err := p.uploadFile(ui, comm, remoteValidationKeyPath, p.config.ValidationKeyPath); err != nil { - return fmt.Errorf("Error copying validation key: %s", err) - } - } - jsonPath, err := p.createJson(ui, comm) if err != nil { return fmt.Errorf("Error creating JSON attributes: %s", err)