Terraform provider reference / resources / router_openvpn_device

fiberax_router_openvpn_device (Resource)

A device of a router's OpenVPN tunnel. The platform issues the device a certificate and returns the complete .ovpn profile ONCE, on creation.

The profile contains the device's private key and is stored in state (as a sensitive value). Encrypt your remote state. The platform never returns the profile again: an imported device has an empty profile, and a lost profile is replaced by recreating the device (terraform taint), which revokes the old certificate.

The tunnel must be enabled before a device is added: reference fiberax_router_openvpn so that Terraform orders them. Up to ten devices per tunnel. The only changeable field is name.

Example Usage

# A device of the router's OpenVPN tunnel. The platform issues a certificate and
# returns the complete .ovpn profile ONCE, on creation.
#
# THE PROFILE CONTAINS THE DEVICE'S PRIVATE KEY AND IS STORED IN STATE: encrypt
# your remote state. An imported device has an empty profile; a lost profile is
# replaced by recreating the device (terraform taint), which revokes the old
# certificate.
resource "fiberax_router_openvpn_device" "phone" {
  # Referencing the tunnel resource makes Terraform enable it before adding the device.
  server_id = fiberax_router_openvpn.vpn.server_id
  name      = "phone"
}

# Write the profile to a file for the device.
resource "local_sensitive_file" "phone_ovpn" {
  filename = "${path.module}/phone.ovpn"
  content  = fiberax_router_openvpn_device.phone.profile
}

Schema

Required

Read-Only

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# The import ID is the router's server ID and the device ID, separated by a comma.
# The profile of an imported device is empty: the platform hands it out once, on creation.
terraform import fiberax_router_openvpn_device.phone 11102,dev1

Generated from the provider schema for version 0.3.0. How to install the provider: Terraform provider.