Skip to content

Commit

Permalink
ssh: make ssh bastion error message more precise
Browse files Browse the repository at this point in the history
When running a config that specifies a SSH communicator with a bastion
without any authentication option, the proposed resolution would only
include password or private key, and left agent authentication out of
the error message.

This commit adds it to the list of options to resolve it.
  • Loading branch information
lbajolet-hashicorp committed Aug 18, 2022
1 parent 42da5e2 commit 28533d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions communicator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,10 @@ func (c *Config) prepareSSH(ctx *interpolate.Context) []error {
}
}

if c.SSHBastionHost != "" && !c.SSHBastionAgentAuth {
if c.SSHBastionPassword == "" && c.SSHBastionPrivateKeyFile == "" {
if c.SSHBastionHost != "" {
if c.SSHBastionPassword == "" && c.SSHBastionPrivateKeyFile == "" && !c.SSHBastionAgentAuth {
errs = append(errs, errors.New(
"ssh_bastion_password or ssh_bastion_private_key_file must be specified"))
"ssh_bastion_password, ssh_bastion_private_key_file or ssh_bastion_agent_auth must be specified"))
} else if c.SSHBastionPrivateKeyFile != "" {
path, err := pathing.ExpandUser(c.SSHBastionPrivateKeyFile)
if err != nil {
Expand Down

0 comments on commit 28533d7

Please sign in to comment.