Terraform Provider for Pritunl VPN Server

Overview
Pritunl logo Terraform logo

Terraform Provider for Pritunl VPN Server

Release Registry License
Go Report Card

Requirements

  • Terraform >=0.13.x
  • Go 1.16.x (to build the provider plugin)

Building The Provider

$ git clone [email protected]:disc/terraform-provider-pritunl
$ make build

Example usage

Take a look at the examples in the documentation of the registry or use the following example:

# Set the required provider and versions
terraform {
  required_providers {
    pritunl = {
      source  = "disc/pritunl"
      version = "0.0.4"
    }
  }
}

# Configure the pritunl provider
provider "pritunl" {
  url    = "https://vpn.server.com"
  token  = "api-token"
  secret = "api-secret"
  insecure = false
}

# Create a pritunl organization resource
resource "pritunl_organization" "developers" {
  name = "Developers"
}

# Create a pritunl user resource 
resource "pritunl_user" "steve" {
  name            = "steve"
  organization_id = pritunl_organization.developers.id
  email           = "[email protected]"
  groups = [
    "developers",
  ]
}

# Create a pritunl server resource
resource "pritunl_server" "example" {
  name      = "example"
  port      = 15500
  protocol  = "udp"
  network   = "192.168.1.0/24"
  groups    = [
    "admins",
    "developers",
  ]
  
  # Attach the organization to the server
  organization_ids = [
    pritunl_organization.developers.id,
  ]

  # Describe all the routes manually
  # Default route 0.0.0.0/0 will be deleted on the server creation
  route {
    network = "10.0.0.0/24"
    comment = "Private network #1"
    nat     = true
  }
  
  route {
    network = "10.2.0.0/24"
    comment = "Private network #2"
    nat     = false
  }
  
  # Or create dynamic routes from variables
  dynamic "route" {
    for_each = var.common_routes
    content {
        network = route.value["network"]
        comment = route.value["comment"]
        nat     = route.value["nat"]
      }
  }
}

Importing exist resources

Describe exist resource in the terraform file first and then import them:

Import an organization:

# Describe a pritunl organization resource
resource "pritunl_organization" "developers" {
  name = "Developers"
}

Execute the shell command:

terraform import pritunl_organization.developers ${ORGANIZATION_ID}
terraform import pritunl_organization.developers 610e42d2a0ed366f41dfe6e8

The organization ID (as well as other resource IDs) can be found in the Pritunl API responses or in the HTML document response.

Import a user:

# Describe a pritunl user resource
resource "pritunl_user" "steve" {
  name            = "steve"
  organization_id = pritunl_organization.developers.id
  email           = "[email protected]"
}

Execute the shell command:

terraform import pritunl_user.steve ${ORGANIZATION_ID}-${USER_ID}
terraform import pritunl_user.steve 610e42d2a0ed366f41dfe6e8-610e42d6a0ed366f41dfe72b

Import a server:

# Describe a pritunl server resource
resource "pritunl_server" "example" {
  name      = "example"
  port      = 15500
  protocol  = "udp"
  network   = "192.168.1.0/24"
  groups    = [
    "developers",
  ]

  # Attach the organization to the server
  organization_ids = [
    pritunl_organization.developers.id,
  ]

  # Describe all the routes manually
  # Default route 0.0.0.0/0 will be deleted on the server creation
  route {
    network = "10.0.0.0/24"
    comment = "Private network #1"
    nat     = true
  }
}

Execute the shell command:

terraform import pritunl_server.example ${SERVER_ID}
terraform import pritunl_server.example 60cd0bfa7723cf3c911468a8

License

The Terraform Pritunl Provider is available to everyone under the terms of the Mozilla Public License Version 2.0. Take a look the LICENSE file.

Releases(v0.0.7)
Owner
Alexandr Hacicheant
Software Engineer
Alexandr Hacicheant
Data source provider for Terraform that interacts with the Solana networks

Terraform Solana Provider Registry Page Requirements Terraform >= 0.13.x Go 1.16.x (for building from source) Example Usage Full provider documentatio

Matthew Callens 4 Sep 10, 2021
Layer2 version of wireguard with Floyd Warshall implement in go.

Etherguard 中文版README A Full Mesh Layer2 VPN based on wireguard-go OSPF can find best route based on it's cost. But sometimes the lentancy are differen

日下部 詩 7 Sep 17, 2021
A fork of the simple WireGuard VPN server GUI community maintained

Subspace - A simple WireGuard VPN server GUI Subspace - A simple WireGuard VPN server GUI Slack Screenshots Features Contributing Setup 1. Get a serve

null 1.4k Sep 21, 2021
In memory Key/Value store in go using gRPC.

In memory cache, using gRPC Contents About Running Server Local Docker Kubernetes Example Helm Terraform API Add Get GetByPrefix GetAllItems DeleteKey

Kautilya Tripathi 137 Sep 3, 2021
Erda's infrastructure framework

Erda Infra Translations: English | 简体中文 Erda Infra is a lightweight microservices framework implements by golang, which offers many useful modules and

Erda 75 Sep 22, 2021
A flexible configuration manager for Wireguard networks

Drago A flexible configuration manager for WireGuard networks Drago is a flexible configuration manager for WireGuard networks which is designed to ma

Seashell 759 Sep 24, 2021
⛵ EdgeVPN: the immutable, decentralized, statically built VPN. NO central server!

⛵ EdgeVPN Fully Decentralized. Immutable. Portable. Easy to use Statically compiled VPN Usage Generate a config: ./edgevpn -g > config.yaml Run it on

Ettore Di Giacinto 7 Sep 21, 2021
Decentralized VPN in golang

LCVPN - Light decentralized VPN in golang Originally this repo was just an answer on a question "how much time it'll take to write my own simple VPN i

Anton Skorochod 448 Sep 21, 2021
A pluggable backend API that enforces the Event Sourcing Pattern for persisting & broadcasting application state changes

A pluggable "Application State Gateway" that enforces the Event Sourcing Pattern for securely persisting & broadcasting application state changes

null 25 Aug 26, 2021
Decentralized VPN

Decentralized VPN The RadVPN doesn't need any central point as it connects to other nodes directly (full mesh) it has built-in router that helps packe

Mehrdad Arshad Rad 1k Sep 26, 2021
A Lightweight VPN Built on top of Libp2p for Truly Distributed Networks.

Hyprspace A Lightweight VPN Built on top of Libp2p for Truly Distributed Networks. demo.mp4 Table of Contents A Bit of Backstory Use Cases A Digital N

Hyprspace 152 Sep 22, 2021
High performance DNS over HTTPS client & server

DNS-over-HTTPS Client and server software to query DNS over HTTPS, using Google DNS-over-HTTPS protocol and IETF DNS-over-HTTPS (RFC 8484). Guides Tut

Star Brilliant 1.4k Sep 17, 2021
Simple edge server / reverse proxy

reproxy Reproxy is simple edge HTTP(s) sever / reverse proxy supporting various providers (docker, static, file). One or more providers supply informa

Umputun 868 Sep 24, 2021
The fastest way to create self-hosted exit-servers

inletsctl - the fastest way to create self-hosted exit-servers inletsctl automates the task of creating an exit-server (tunnel server) on public cloud

inlets 366 Sep 17, 2021
Standalone client for proxies of Opera VPN

opera-proxy Standalone Opera VPN client. Younger brother of hola-proxy. Just run it and it'll start a plain HTTP proxy server forwarding traffic throu

null 226 Sep 20, 2021
🐈📦 nyaa.si client library for Go. Fetch Anime, Manga, Music and more torrents

?? ?? go-nyaa nyaa.si client library for Go Built on top of: gofeed - search using RSS colly - scrap torrent details page Original idea: ejnshtein/nya

Ilya Revenko 15 Jul 18, 2021
Connect your devices into a single private WireGuard®-based mesh network.

Wiretrustee A WireGuard®-based mesh network that connects your devices into a single private network. Why using Wiretrustee? Connect multiple devices

null 1.3k Sep 23, 2021
A toy MMO example built using Ebiten and WebRTC DataChannels (UDP)

Ebiten WebRTC Toy MMO ⚠️ This is a piece of incomplete hobby work and not robust. Please read the "Why does this project exist?" section. What is this

Jae Bentvelzen 8 Jun 3, 2021
Simple Web based configuration generator for WireGuard. Demo:

Wg Gen Web Simple Web based configuration generator for WireGuard. Why another one ? All WireGuard UI implementations are trying to manage the service

vx3r 641 Sep 22, 2021