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.
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!
Name | Version |
---|---|
n/a | |
random | n/a |
Name | Source | Version |
---|---|---|
gce-container | terraform-google-modules/container-vm/google | n/a |
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 |
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 |