A terraform template to produce a VPN server on gcloud.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Leverage Google Cloud to create a personal VPN server and client side configuration all in one step.
The code has been primarily used on OSX, but can be adapted for Windows or Linux users.


You'll need to install Terraform and the gcloud cli tool.


Generate a new set of public and private ssh keys to use with your server:

    $ ssh-keygen

Create a fresh project in your GCE account, and take note of the three fields associated with it:

  1. The project name
  2. The project id
  3. The organization number

Enter the filename of the ssh public key, and the project values into the configuration file:

    $ vi config/config.tfvars

Create a VPN Server

Once you have configured the settings, you can provision a server:

    ./form.sh create

This could take as long as 15 minutes, as generating the diffie-hellman key takes considerable time on a economical compute instance. Once it has finished, a 'configurations' folder will be created, containing 5 unique client opvn files.

If you're on a mac, download tunnelblick and import the configuration. There are similar tools for Windows/Linux based computers.

Delete your VPN Server

If you're finished with your VPN server, simply run the following command:

    ./form.sh destroy