Skip to content

jlucktay/terraform-google-tailscale-exit-node

Repository files navigation

Tailscale Exit Node on Google Cloud

Infrastructure for a Tailscale exit node.

  • VM running Debian that will join the tailnet at launch and advertise as an exit node.
  • Dedicated VPC network and subnet, and a firewall rule to allow SSHing into the exit node VM via Identity-Aware Proxy.
  • Enablement of the necessary Google Cloud APIs/services.

Usage

Both the Google Cloud and Tailscale providers will require authentication:

If the exit node VM needs to be rotated, into a different region for example, it is recommended to have Terraform force-replace the tailscale_tailnet_key resource, like so:

terraform apply --replace=module.this.tailscale_tailnet_key.one_time_use

Requirements

The following requirements are needed by this module:

Providers

The following providers are used by this module:

Modules

No modules.

Resources

The following resources are used by this module:

Required Inputs

The following input variables are required:

Description: Google Cloud region to deploy resources in.

Type: string

Optional Inputs

The following input variables are optional (have default values):

Description: Activate required API services for the Google Cloud project.

Type: bool

Default: true

Description: Activate Google Cloud VM Manager.

Type: bool

Default: false

Description: Whether or not to use Google Cloud's Premium Tier network.

Type: bool

Default: false

Description: A map of labels to apply to contained resources.

Type: map(string)

Default: {}

Description: UUID of a check at Healthchecks.io that the exit node VM will poll every 15 minutes with curl from a cron job. If left unset then the check will not be set up.

Type: string

Default: ""

Outputs

The following outputs are exported:

Description: The service APIs that have been enabled by this module.

Description: The ID of the exit node VM.

Description: The public IP address of the exit node VM.

Description: The command line to run for SSH access into the exit node VM.

Description: The ID of the regional subnet.

Description: The ID of the Tailscale auth key that the exit node VM joined the tailnet with.

Description: The ID of the service account attached to the VM. If the enable_vm_manager input variable is set to true then this SA will also enable VM Manager.

Description: The ID of the main VPC.