{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/5589","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/5589/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/5589/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/5589/events","html_url":"https://github.com/hashicorp/terraform/issues/5589","id":140222388,"number":5589,"title":"Output to a file?","user":{"login":"rodlogic","id":1887682,"avatar_url":"https://avatars.githubusercontent.com/u/1887682?v=3","gravatar_id":"","url":"https://api.github.com/users/rodlogic","html_url":"https://github.com/rodlogic","followers_url":"https://api.github.com/users/rodlogic/followers","following_url":"https://api.github.com/users/rodlogic/following{/other_user}","gists_url":"https://api.github.com/users/rodlogic/gists{/gist_id}","starred_url":"https://api.github.com/users/rodlogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodlogic/subscriptions","organizations_url":"https://api.github.com/users/rodlogic/orgs","repos_url":"https://api.github.com/users/rodlogic/repos","events_url":"https://api.github.com/users/rodlogic/events{/privacy}","received_events_url":"https://api.github.com/users/rodlogic/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/core","name":"core","color":"cccccc"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-11T16:04:39Z","updated_at":"2016-03-11T16:43:25Z","closed_at":"2016-03-11T16:22:18Z","body":"It would be nice to be able to generate a file as an output. \r\n\r\nOnce I apply, I have environments in multiple regions with a variety of hosts behind a bastion host. It would be nice to be able to generate an SSH config as an output. For example:\r\n\r\n```\r\noutput \"SSH_CONFIG\" {\r\n  value = <<EOF\r\n\r\n# --BEGIN SSH config for hosts in the '${var.DOMAIN}' domain ------------------\r\nHost ${var.DOMAIN}-bastion\r\n  User ec2-user\r\n  ForwardX11 no\r\n  Compression yes\r\n  IdentitiesOnly yes\r\n  StrictHostKeyChecking no\r\n  UserKnownHostsFile /dev/null\r\n  IdentityFile ~/.ssh/${var.KEY_NAME}\r\n  IdentityFile ~/.ssh/${var.KEY_NAME}.pem\r\n  HostName ${module.IN.BASTION_EIP}\r\n  ControlMaster auto\r\n  ControlPath /tmp/%r@%h:%p\r\n  ControlPersist yes\r\n\r\nHost ${var.DOMAIN}-ops-useast1-nat1\r\n  User ec2-user\r\n  StrictHostKeyChecking no\r\n  UserKnownHostsFile /dev/null\r\n  HostName ${module.IN.NAT_EIP_1}\r\n  ProxyCommand ssh -A ${var.DOMAIN}-bastion -W %h:%p\r\n\r\nHost ${var.DOMAIN}-ops-useast1-nat2\r\n  User ec2-user\r\n  StrictHostKeyChecking no\r\n  UserKnownHostsFile /dev/null\r\n  HostName ${module.IN.NAT_EIP_2}\r\n  ProxyCommand ssh -A ${var.DOMAIN}-bastion -W %h:%p\r\n\r\nHost ${var.DOMAIN}-prod-useast1-nat1\r\n  User ec2-user\r\n  StrictHostKeyChecking no\r\n  UserKnownHostsFile /dev/null\r\n  HostName ${module.PROD-US-EAST-1.NAT_EIP_1}\r\n  ProxyCommand ssh -A ${var.DOMAIN}-bastion -W %h:%p\r\n\r\nHost ${var.DOMAIN}-prod-useast1-nat2\r\n  User ec2-user\r\n  StrictHostKeyChecking no\r\n  UserKnownHostsFile /dev/null\r\n  HostName ${module.PROD-US-EAST-1.NAT_EIP_1}\r\n  ProxyCommand ssh -A ${var.DOMAIN}-bastion -W %h:%p\r\n\r\nHost ${var.DOMAIN}-prod-eucentral1-nat1\r\n  User ec2-user\r\n  StrictHostKeyChecking no\r\n  UserKnownHostsFile /dev/null\r\n  HostName ${module.PROD-EU-CENTRAL-1.NAT_EIP_1}\r\n  ProxyCommand ssh -A ${var.DOMAIN}-bastion -W %h:%p\r\n\r\nHost ${var.DOMAIN}-prod-eucentral1-nat2\r\n  User ec2-user\r\n  StrictHostKeyChecking no\r\n  UserKnownHostsFile /dev/null\r\n  HostName ${module.PROD-EU-CENTRAL-1.NAT_EIP_2}\r\n  ProxyCommand ssh -A ${var.DOMAIN}-bastion -W %h:%p\r\n# --END SSH config for hosts in the '${var.DOMAIN}' domain --------------------\r\nEOF\r\n}\r\n```\r\n\r\nI now copy and append this to my ~/.ssh/config, but it would be much nicer to be able to generate a local ./ssh_config file that I can use with ```ssh -F ./ssh_config ...```.\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/195445294","html_url":"https://github.com/hashicorp/terraform/issues/5589#issuecomment-195445294","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/5589","id":195445294,"user":{"login":"rodlogic","id":1887682,"avatar_url":"https://avatars.githubusercontent.com/u/1887682?v=3","gravatar_id":"","url":"https://api.github.com/users/rodlogic","html_url":"https://github.com/rodlogic","followers_url":"https://api.github.com/users/rodlogic/followers","following_url":"https://api.github.com/users/rodlogic/following{/other_user}","gists_url":"https://api.github.com/users/rodlogic/gists{/gist_id}","starred_url":"https://api.github.com/users/rodlogic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodlogic/subscriptions","organizations_url":"https://api.github.com/users/rodlogic/orgs","repos_url":"https://api.github.com/users/rodlogic/repos","events_url":"https://api.github.com/users/rodlogic/events{/privacy}","received_events_url":"https://api.github.com/users/rodlogic/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T16:43:25Z","updated_at":"2016-03-11T16:43:25Z","body":"Hi @phinze - thanks! I am happy with the first one."}}