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
name(String) Your name for the device, up to 64 characters.server_id(Number) The router whose tunnel the device belongs to. Changing it recreates the resource.
Read-Only
address(String) Address of the device inside the tunnel, fixed by the platform.id(String) Device identifier on the router (dev1), assigned by the platform. Numbers are not reused after a revocation.online(Boolean) The device is connected right now. Not set when the router status could not be read.profile(String, Sensitive) The complete.ovpnprofile: certificate authority, device certificate and the device PRIVATE KEY. Stored in state; encrypt remote state. Returned once by the platform, so it is empty on an imported device - taint the resource to get a new profile (a new certificate).serial(String) Serial number of the device certificate.
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.