Skip to content

DeimosCloud/terraform-google-openvpn

Repository files navigation

Terraform OpenVPN GCP

A terraform module to setup OpenVPN on GCP.

Usage

module "openvpn" {
  source     = "DeimosCloud/openvpn/google"
  version    = "~>2.1.1"
  name       = var.name
  region     = var.region
  project_id = var.project_id
  network    = module.vpc.network
  subnetwork = module.vpc.public_subnetwork
  output_dir = "${path.module}/openvpn"
  users      = ["bob", "alice"]
}

Contributing

Report issues/questions/feature requests on in the issues section.

Full contributing guidelines are covered here.

Requirements

Name Version
terraform >= 0.14

Providers

Name Version
google 4.41.0
local 2.2.3
null 3.1.1
random 3.4.3
tls 4.0.3

Modules

No modules.

Resources

Name Type
google_compute_address.default resource
google_compute_disk.this resource
google_compute_firewall.allow-external-ssh resource
google_compute_firewall.allow-openvpn-udp-port resource
google_compute_instance_from_template.this resource
google_compute_instance_template.tpl resource
local_sensitive_file.private_key resource
null_resource.openvpn_download_configurations resource
null_resource.openvpn_update_users_script resource
random_id.password resource
random_id.this resource
tls_private_key.ssh-key resource

Inputs

Name Description Type Default Required
auto_delete_disk Whether or not the boot disk should be auto-deleted bool false no
create_ssh_firewall_rule Indicates whether to create SSH Firewall rule bool false no
disk_size_gb n/a string "30" no
disk_type (Optional) The GCE disk type. Can be either pd-ssd, local-ssd, pd-balanced or pd-standard string "pd-standard" no
dns_servers The DNS servers to be configured list(string)
[
"8.8.8.8",
"8.8.4.4"
]
no
image_family n/a string "ubuntu-2004-lts" no
install_script_url The commit sha we are using in order to determine which version of the install file to use: https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh string "https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh" no
labels Labels, provided as a map map(string) {} no
machine_type Machine type to create, e.g. n1-standard-1 string "n1-standard-1" no
metadata Metadata, provided as a map map(string) {} no
name The name to use when generating resources string "" no
network The name or self_link of the network to attach this interface to. Use network attribute for Legacy or Auto subnetted networks and subnetwork for custom subnetted networks. string "default" no
network_project_id The GCP Host Project ID string null no
network_tier Network network_tier string "STANDARD" no
output_dir Folder to store all user openvpn details string "openvpn" no
project_id The GCP Project ID string null no
region The GCP Project Region string null no
remote_user The user to operate as on the VM. SSH Key is generated for this user string "ubuntu" no
route_only_private_ips Routes only private IPs through the VPN (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) bool false no
service_account Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account.
object({
email = string,
scopes = set(string)
})
{
"email": null,
"scopes": []
}
no
ssh_source_ranges SSH IP ranges allowed to ssh to openvpn server list(string) [] no
subnetwork The name of the subnetwork to attach this interface to. The subnetwork must exist in the same region this instance will be created in. Either network or subnetwork must be provided. string null no
tags network tags to attach to the instance list(string) [] no
users list of user to create list(string) [] no
zone The GCP Zone to deploy VPN Compute instance to string n/a yes

Outputs

Name Description
address The created address
users Created Users