Skip to content

A collection of Terraform code for quickly creating your own Wireguard VPN on Google Cloud Platform

License

Notifications You must be signed in to change notification settings

jacks-reid/wireguard-on-gcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wireguard VPN on Google Cloud Compute Engine

This repository leverages Google Cloud's capability to deploy a container directly on a Compute Engine VM to run a Wireguard VPN server for personal use.

Usage

Use Terraform to automatically create the infrastructure needed to host the Wireguard VPN server. Make a copy of the example.tfvars file and edit the file to your liking:

cp example.tfvars myvalues.tfvars

Now run Terraform referencing your new variables file:

terraform apply --auto-approve -var-file=myvalues.tfvars

SSH to your newly created virtual machine from within the Google Cloud console and scan the QR code automatically generated with your Wireguard app.

# get the name of the container started
docker ps
# get the QR code from the container logs
docker logs $CONTAINER_NAME

Done!

Providers

Name Version
google n/a
random n/a

Modules

Name Source Version
gce-container terraform-google-modules/container-vm/google n/a

Resources

Name Type
google_compute_address.static resource
google_compute_firewall.allow_iap_ssh resource
google_compute_firewall.allow_vpn_port resource
google_compute_instance.vm resource
google_compute_network.vpn_network resource
google_compute_subnetwork.vpn_subnetwork resource
google_service_account.service_account resource
random_integer.randint resource

Inputs

Name Description Type Default Required
machine_type Machine type of the deployed VM any n/a yes
network_name Name of the network that will be created any n/a yes
project_id The project ID to deploy into any n/a yes
region GCP region to deploy into any n/a yes
subnetwork_name Name of the subnetwork that will be created any n/a yes
vm_name Name of the VM to deploy the container onto any n/a yes
vpn_num_peers Number of Wireguard peers to auto-generate any n/a yes
vpn_server_port Server port for Wiregard (often 51820) any n/a yes
zone GCP zone to deploy into any n/a yes

About

A collection of Terraform code for quickly creating your own Wireguard VPN on Google Cloud Platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages