This Terraform provides allows to use ssh tunnels.
This provider plugin is maintained by Sedicii.
curl https://raw.githubusercontent.com/Sedicii/terraform-provider-ssh/master/scripts/install-ssh-tf-pluging.sh | bash
provider "ssh" {
version = "~> 0.1.0"
}
data "ssh_tunnel" "bastion" {
bastion_host = "${var.bastion_host}"
bastion_port = "${var.bastion_port}"
bastion_user = "${var.bastion_user}"
bastion_private_key = "${var.bastion_private_key}"
// bastion_password = "${var.bastion_password}"
bastion_host_key = "${var.bastion_host_key}"
remote_host = "${var.remote_host}"
remote_port = "${var.remote_port}"
}
For a more detailed example look at the example directory !!
Clone repository to: $GOPATH/src/github.com/sedicii/terraform-provider-ssh
$ mkdir -p $GOPATH/src/github.com/sedicii; cd $GOPATH/src/github.com/sedicii
$ git clone [email protected]:sedicii/terraform-provider-ssh
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/sedicii/terraform-provider-ssh
$ make build
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.8+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin
to your $PATH
.
To compile the provider, run make build
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
$ make bin
...
$ $GOPATH/bin/terraform-provider-ssh
...
In order to test the provider, you can simply run make test
.
$ make test