俺です.
とりあえず寺の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