terraform-cloudinit-tor


Updated March 2, 2023

Generates cloud-init user data for a Tor server (relay or bridge) using the latest stable Debian release. It may also work with Debian derivatives but has not been tested with anything other than Debian. You may want to check out the sr2c/torrc and sr2c/contactinfo modules for generating torrc configuration files and ContactInfo Information Sharing Specification lines respectively.

The tor package will be installed from the official Tor Project Debian repository at deb.torproject.org. The signing key for the repository is included in this module.

The obfs4proxy and nyx packages can be installed by setting the respective inputs. For obfs4proxy, an apt preference file is installed to always enable the use of stable backports. This will only work on Debian and on other derivatives (e.g. Ubuntu) an older version of obfs4proxy would be installed from the available repositories. Additional packages may also be installed using the additional_packages input.

The configuration will also change the default congestion control algorithm to BBR as it has been observed to perform better in many of the scenarios where Tor is used. If this is really a problem then please submit an issue and it could be made optional.

Usage

module "user_data" {
  source = "sr2c/tor/cloudinit"
  # TODO: version = "x.x.x"
  torrc  = <<-EOT
  Nickname    TerraformRelay
  ORPort      9001
  ContactInfo email@example.com
  EOT
}

Requirements

NameVersion
terraform>= 0.15.0
cloudinit>= 2.2.0

Providers

NameVersion
cloudinit2.2.0

Modules

No modules.

Resources

NameType
cloudinit_config.thisdata source

Inputs

NameDescriptionTypeDefaultRequired
additional_packagesA list of additional packages to be installed using apt.list(string)[]no
gzipCompress the final user-data with gzip.booltrueno
install_nyxInstall the nyx package using apt.boolfalseno
install_obfs4proxyInstall the obfs4proxy package using apt.boolfalseno
torrcThe torrc configuration file to be installed.stringn/ayes

Outputs

NameDescription
renderedThe final rendered cloud-init user data.
Tags: