LoginSignup
2
0

More than 5 years have passed since last update.

[terraform]俺でもわかる雑に~/.ssh/configを作るoutput

Posted at

俺です.
とりあえず寺のoutputつかってsshのconfig作って鼻ほじったろってときのtipsです。

outputの定義

  • ServerAliveXXXXはお好みで
output "ssh_config" {
    value =<<EOF
Host ${var.oreno-saba["tag_name"]}
    Hostname ${aws_instance.oreno-saba.private_ip}
    ProxyCommand ssh oreno-fumidai -W %h:%p
Host ${var.oreno-fumidai["tag_name"]}
    Hostname ${aws_eip.oreno-fumidai.public_ip}
Host oreno-*
    User ec2-user
    IdentityFile ~/.ssh/orenokey.pem
    ServerAliveInterval 15
    ServerAliveCountMax 10
    StrictHostKeyChecking no    
EOF
}

show

  • 以下のように雑に出力されるので ssh_config = を削って~/.ssh/configなり好きなところに保存してください
ssh_config = Host oreno-saba
    Hostname 192.168.0.1
    ProxyCommand ssh oreno-fumidai -W %h:%p
Host oreno-fumidai
    Hostname 54.0.0.1
Host oreno-*
    User ec2-user
    IdentityFile ~/.ssh/orenokey.pem
    ServerAliveInterval 15
    ServerAliveCountMax 10
    StrictHostKeyChecking no
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0