flaupretre/terraform-ssh-tunnel

Error on apply : nohup: timeout: No such file or directory

Closed this issue ยท 4 comments

Hi ๐Ÿ‘‹ ,

I am trying to use the ssh tunnel module, which seems to be awesome for my use case btw โค๏ธ

Here is how I configured it:

module "db_tunnel" {
  source  = "flaupretre/tunnel/ssh"
  version = "1.6.0"

  target_host = data.aws_db_instance.main.address
  target_port = data.aws_db_instance.main.port

  gateway_host = data.aws_instance.bastion.public_ip
  gateway_user = "ubuntu"

  ssh_cmd = "ssh -i ~/.ssh/bastion"
}

provider "postgresql" {
  alias    = "tunnel"
  scheme   = "awspostgres"
  host     = module.db_tunnel.host
  port     = module.db_tunnel.port
  username = "root"
  password = "notsecure"
  // superuser = false
}

Here is the apply output

โ”‚ Error: failed to execute "bash": Child process (28391) failure - Aborting
โ”‚ Child diagnostics follow:
โ”‚ nohup: timeout: No such file or directory
โ”‚ 
โ”‚ 
โ”‚   with module.db_tunnel.data.external.ssh_tunnel[0],
โ”‚   on .terraform/modules/db_tunnel/main.tf line 15, in data "external" "ssh_tunnel":
โ”‚   15: data external ssh_tunnel {

Is there something wrong here? ๐Ÿ˜ข

Looks like it was a mac issue.

nohup wasn't the 'real' nohup.

Instead, I used gnohup, which works for whatever reason. Thanks ๐ŸŽ

Hello @RomainBillot,

Hate to bother, but could you explain a bit more how you used gnohup to get around this issue? Blocked here. Many thanks.

I'm also interested by a patch that would automatically switch to a 'nohup' alternative if it is found in the path, for instance. I'm sorry but I don't have access to a mac environment. So I can't do it by myself.

For anyone getting here from Google:

The same error message also appears if the timeout command line utility is missing. Which it is by default on MacOS. You can install it via homebrew with brew install coreutils. (source: https://stackoverflow.com/a/70109348)