在 Terragrunt before_hook 中激活 ssh socks5 代理
Activate a ssh sock5 proxy in a Terragrunt before_hook
我正在尝试在应用 RDS Terraform 堆栈之前激活 ssh sock5 代理。
为此,我将 ssh 命令配置到 Terragrunt before_hook 块中,示例如下:
before_hook "ssh_tunnel_start" {
commands = ["init", "plan", "apply"]
execute = ["ssh", "-D", "3306", "-M", "-S", "/tmp/ssh-control-socket", "-fnNTC", "<bastion_host>"]
}
如果我在我的终端中手动执行 ssh 命令,它会按预期工作,ssh 绑定本地端口然后分离,但是从 Terragrunt 挂钩执行代理已启动但 ssh 命令不分离并且 Terragrunt进程无法继续并卡在挂钩命令上。
我找到了一个使用 screen 的可行解决方案,也许有更好的解决方案。
before_hook "ssh_tunnel_start" {
commands = ["init", "plan", "apply"]
execute = ["screen", "-d", "-m", "ssh", "-D", "3306", "-M", "-S", "/tmp/ssh-control-socket", "-fnNTC", "<bastion_host>"
}
我正在尝试在应用 RDS Terraform 堆栈之前激活 ssh sock5 代理。
为此,我将 ssh 命令配置到 Terragrunt before_hook 块中,示例如下:
before_hook "ssh_tunnel_start" {
commands = ["init", "plan", "apply"]
execute = ["ssh", "-D", "3306", "-M", "-S", "/tmp/ssh-control-socket", "-fnNTC", "<bastion_host>"]
}
如果我在我的终端中手动执行 ssh 命令,它会按预期工作,ssh 绑定本地端口然后分离,但是从 Terragrunt 挂钩执行代理已启动但 ssh 命令不分离并且 Terragrunt进程无法继续并卡在挂钩命令上。
我找到了一个使用 screen 的可行解决方案,也许有更好的解决方案。
before_hook "ssh_tunnel_start" {
commands = ["init", "plan", "apply"]
execute = ["screen", "-d", "-m", "ssh", "-D", "3306", "-M", "-S", "/tmp/ssh-control-socket", "-fnNTC", "<bastion_host>"
}