Skip to content
This repository was archived by the owner on Jun 27, 2024. It is now read-only.
/ terrassh Public archive

TerraSSH is a tool to make it easy to SSH into Terraform managed instances.

License

Notifications You must be signed in to change notification settings

tshak/terrassh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TerraSSH

TerraSSH is a tool to make it easy to SSH into Terraform managed instances. This is particularly useful in development scenarios where you don't have a stable inventory of machines. For example, to SSH into the first web instance, simply use:

$ terrassh web

Installation

Prerequisites

Ensure that Terraform is in your path.

Install with Golang

go get github.com/tshak/terrassh

Install Manually

  1. Download the release for your platform
  2. Extract and copy to your path (e.g. /usr/local/bin)

Note: While Windows binaries are available, they have not been tested. Your best bet is to use Windows Subsystem for Linux. PR's welcome.

Terraform Configuration

TerraSSH utilizes Output Variables to allow you to configure one or more sets of machines to easily SSH into.

There are three output variables you must set. A prefix is used so that you can distinguish between different groups of machines. For example, if your prefix is web and the variable suffix below is _ssh_hosts, the output variable must be named web_ssh_hosts. All variables are required.

variable suffix description
_ssh_hosts A string array of hosts (IP or hostnames)
_ssh_key_path The key path to the SSH private key
_ssh_username The SSH username

Note: You must run a terraform refresh or terraform apply in order for any output variables to take affect.

See example.tf for a basic example. See the aws_example folder for a full AWS example.

Usage

After configuring Terraform, from the root of your Terraform workspace, you may run

$ terrassh <prefix> (hostIndex)

Run terrassh without any arguments to get detailed help.

Examples

If you defined web_hosts which contains 3 hosts, to SSH into the last host use:

$ terrassh web 2

Or to SSH into the first host:

$ terrassh web

About

TerraSSH is a tool to make it easy to SSH into Terraform managed instances.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors